08:58:32 Triggered by Gerrit: https://git.opendaylight.org/gerrit/c/transportpce/+/113906 08:58:32 Running as SYSTEM 08:58:32 [EnvInject] - Loading node environment variables. 08:58:32 Building remotely on prd-ubuntu2004-docker-4c-16g-43703 (ubuntu2004-docker-4c-16g) in workspace /w/workspace/transportpce-tox-verify-transportpce-master 08:58:32 [ssh-agent] Looking for ssh-agent implementation... 08:58:32 [ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) 08:58:32 $ ssh-agent 08:58:32 SSH_AUTH_SOCK=/tmp/ssh-hyif9cD9Pa8j/agent.13643 08:58:32 SSH_AGENT_PID=13645 08:58:32 [ssh-agent] Started. 08:58:32 Running ssh-add (command line suppressed) 08:58:32 Identity added: /w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_3491057368023070377.key (/w/workspace/transportpce-tox-verify-transportpce-master@tmp/private_key_3491057368023070377.key) 08:58:32 [ssh-agent] Using credentials jenkins (jenkins-ssh) 08:58:32 The recommended git tool is: NONE 08:58:34 using credential jenkins-ssh 08:58:34 Wiping out workspace first. 08:58:35 Cloning the remote Git repository 08:58:35 Cloning repository git://devvexx.opendaylight.org/mirror/transportpce 08:58:35 > git init /w/workspace/transportpce-tox-verify-transportpce-master # timeout=10 08:58:35 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 08:58:35 > git --version # timeout=10 08:58:35 > git --version # 'git version 2.25.1' 08:58:35 using GIT_SSH to set credentials jenkins-ssh 08:58:35 Verifying host key using known hosts file 08:58:35 You're using 'Known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Security' -> 'Git Host Key Verification Configuration' and configure host key verification. 08:58:35 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce +refs/heads/*:refs/remotes/origin/* # timeout=10 08:58:38 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 08:58:38 > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10 08:58:38 > git config remote.origin.url git://devvexx.opendaylight.org/mirror/transportpce # timeout=10 08:58:38 Fetching upstream changes from git://devvexx.opendaylight.org/mirror/transportpce 08:58:38 using GIT_SSH to set credentials jenkins-ssh 08:58:38 Verifying host key using known hosts file 08:58:38 You're using 'Known hosts file' strategy to verify ssh host keys, but your known_hosts file does not exist, please go to 'Manage Jenkins' -> 'Security' -> 'Git Host Key Verification Configuration' and configure host key verification. 08:58:38 > git fetch --tags --force --progress -- git://devvexx.opendaylight.org/mirror/transportpce refs/changes/06/113906/10 # timeout=10 08:58:38 > git rev-parse fc580132e0506837d64557e4ab9296915c933976^{commit} # timeout=10 08:58:38 JENKINS-19022: warning: possible memory leak due to Git plugin usage; see: https://plugins.jenkins.io/git/#remove-git-plugin-buildsbybranch-builddata-script 08:58:38 Checking out Revision fc580132e0506837d64557e4ab9296915c933976 (refs/changes/06/113906/10) 08:58:38 > git config core.sparsecheckout # timeout=10 08:58:38 > git checkout -f fc580132e0506837d64557e4ab9296915c933976 # timeout=10 08:58:39 Commit message: "Add Tapi Abstracted Node to OR Topo" 08:58:39 > git rev-parse FETCH_HEAD^{commit} # timeout=10 08:58:39 > git rev-list --no-walk 9889c236444fdb4bb40abe9dc03a01d4dc69b802 # timeout=10 08:58:39 > git remote # timeout=10 08:58:39 > git submodule init # timeout=10 08:58:39 > git submodule sync # timeout=10 08:58:39 > git config --get remote.origin.url # timeout=10 08:58:39 > git submodule init # timeout=10 08:58:39 > git config -f .gitmodules --get-regexp ^submodule\.(.+)\.url # timeout=10 08:58:39 ERROR: No submodules found. 08:58:42 provisioning config files... 08:58:42 copy managed file [npmrc] to file:/home/jenkins/.npmrc 08:58:42 copy managed file [pipconf] to file:/home/jenkins/.config/pip/pip.conf 08:58:42 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins7031361240937622887.sh 08:58:42 ---> python-tools-install.sh 08:58:42 Setup pyenv: 08:58:43 * system (set by /opt/pyenv/version) 08:58:43 * 3.8.13 (set by /opt/pyenv/version) 08:58:43 * 3.9.13 (set by /opt/pyenv/version) 08:58:43 * 3.10.13 (set by /opt/pyenv/version) 08:58:43 * 3.11.7 (set by /opt/pyenv/version) 08:58:47 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-BUI9 08:58:47 lf-activate-venv(): INFO: Save venv in file: /tmp/.os_lf_venv 08:58:50 lf-activate-venv(): INFO: Installing: lftools 08:59:19 lf-activate-venv(): INFO: Adding /tmp/venv-BUI9/bin to PATH 08:59:19 Generating Requirements File 08:59:39 Python 3.11.7 08:59:39 pip 24.2 from /tmp/venv-BUI9/lib/python3.11/site-packages/pip (python 3.11) 08:59:40 appdirs==1.4.4 08:59:40 argcomplete==3.5.1 08:59:40 aspy.yaml==1.3.0 08:59:40 attrs==24.2.0 08:59:40 autopage==0.5.2 08:59:40 beautifulsoup4==4.12.3 08:59:40 boto3==1.35.43 08:59:40 botocore==1.35.43 08:59:40 bs4==0.0.2 08:59:40 cachetools==5.5.0 08:59:40 certifi==2024.8.30 08:59:40 cffi==1.17.1 08:59:40 cfgv==3.4.0 08:59:40 chardet==5.2.0 08:59:40 charset-normalizer==3.4.0 08:59:40 click==8.1.7 08:59:40 cliff==4.7.0 08:59:40 cmd2==2.4.3 08:59:40 cryptography==3.3.2 08:59:40 debtcollector==3.0.0 08:59:40 decorator==5.1.1 08:59:40 defusedxml==0.7.1 08:59:40 Deprecated==1.2.14 08:59:40 distlib==0.3.9 08:59:40 dnspython==2.7.0 08:59:40 docker==4.2.2 08:59:40 dogpile.cache==1.3.3 08:59:40 durationpy==0.9 08:59:40 email_validator==2.2.0 08:59:40 filelock==3.16.1 08:59:40 future==1.0.0 08:59:40 gitdb==4.0.11 08:59:40 GitPython==3.1.43 08:59:40 google-auth==2.35.0 08:59:40 httplib2==0.22.0 08:59:40 identify==2.6.1 08:59:40 idna==3.10 08:59:40 importlib-resources==1.5.0 08:59:40 iso8601==2.1.0 08:59:40 Jinja2==3.1.4 08:59:40 jmespath==1.0.1 08:59:40 jsonpatch==1.33 08:59:40 jsonpointer==3.0.0 08:59:40 jsonschema==4.23.0 08:59:40 jsonschema-specifications==2024.10.1 08:59:40 keystoneauth1==5.8.0 08:59:40 kubernetes==31.0.0 08:59:40 lftools==0.37.10 08:59:40 lxml==5.3.0 08:59:40 MarkupSafe==3.0.1 08:59:40 msgpack==1.1.0 08:59:40 multi_key_dict==2.0.3 08:59:40 munch==4.0.0 08:59:40 netaddr==1.3.0 08:59:40 netifaces==0.11.0 08:59:40 niet==1.4.2 08:59:40 nodeenv==1.9.1 08:59:40 oauth2client==4.1.3 08:59:40 oauthlib==3.2.2 08:59:40 openstacksdk==4.0.0 08:59:40 os-client-config==2.1.0 08:59:40 os-service-types==1.7.0 08:59:40 osc-lib==3.1.0 08:59:40 oslo.config==9.6.0 08:59:40 oslo.context==5.6.0 08:59:40 oslo.i18n==6.4.0 08:59:40 oslo.log==6.1.2 08:59:40 oslo.serialization==5.5.0 08:59:40 oslo.utils==7.3.0 08:59:40 packaging==24.1 08:59:40 pbr==6.1.0 08:59:40 platformdirs==4.3.6 08:59:40 prettytable==3.11.0 08:59:40 pyasn1==0.6.1 08:59:40 pyasn1_modules==0.4.1 08:59:40 pycparser==2.22 08:59:40 pygerrit2==2.0.15 08:59:40 PyGithub==2.4.0 08:59:40 PyJWT==2.9.0 08:59:40 PyNaCl==1.5.0 08:59:40 pyparsing==2.4.7 08:59:40 pyperclip==1.9.0 08:59:40 pyrsistent==0.20.0 08:59:40 python-cinderclient==9.6.0 08:59:40 python-dateutil==2.9.0.post0 08:59:40 python-heatclient==4.0.0 08:59:40 python-jenkins==1.8.2 08:59:40 python-keystoneclient==5.5.0 08:59:40 python-magnumclient==4.7.0 08:59:40 python-openstackclient==7.1.3 08:59:40 python-swiftclient==4.6.0 08:59:40 PyYAML==6.0.2 08:59:40 referencing==0.35.1 08:59:40 requests==2.32.3 08:59:40 requests-oauthlib==2.0.0 08:59:40 requestsexceptions==1.4.0 08:59:40 rfc3986==2.0.0 08:59:40 rpds-py==0.20.0 08:59:40 rsa==4.9 08:59:40 ruamel.yaml==0.18.6 08:59:40 ruamel.yaml.clib==0.2.8 08:59:40 s3transfer==0.10.3 08:59:40 simplejson==3.19.3 08:59:40 six==1.16.0 08:59:40 smmap==5.0.1 08:59:40 soupsieve==2.6 08:59:40 stevedore==5.3.0 08:59:40 tabulate==0.9.0 08:59:40 toml==0.10.2 08:59:40 tomlkit==0.13.2 08:59:40 tqdm==4.66.5 08:59:40 typing_extensions==4.12.2 08:59:40 tzdata==2024.2 08:59:40 urllib3==1.26.20 08:59:40 virtualenv==20.27.0 08:59:40 wcwidth==0.2.13 08:59:40 websocket-client==1.8.0 08:59:40 wrapt==1.16.0 08:59:40 xdg==6.0.0 08:59:40 xmltodict==0.14.2 08:59:40 yq==3.4.3 08:59:40 [EnvInject] - Injecting environment variables from a build step. 08:59:40 [EnvInject] - Injecting as environment variables the properties content 08:59:40 PYTHON=python3 08:59:40 08:59:40 [EnvInject] - Variables injected successfully. 08:59:40 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins13971567112299688910.sh 08:59:40 ---> tox-install.sh 08:59:40 + source /home/jenkins/lf-env.sh 08:59:40 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 08:59:40 ++ mktemp -d /tmp/venv-XXXX 08:59:40 + lf_venv=/tmp/venv-bSiN 08:59:40 + local venv_file=/tmp/.os_lf_venv 08:59:40 + local python=python3 08:59:40 + local options 08:59:40 + local set_path=true 08:59:40 + local install_args= 08:59:40 ++ 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 08:59:40 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 08:59:40 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 08:59:40 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 08:59:40 + true 08:59:40 + case $1 in 08:59:40 + venv_file=/tmp/.toxenv 08:59:40 + shift 2 08:59:40 + true 08:59:40 + case $1 in 08:59:40 + shift 08:59:40 + break 08:59:40 + case $python in 08:59:40 + local pkg_list= 08:59:40 + [[ -d /opt/pyenv ]] 08:59:40 + echo 'Setup pyenv:' 08:59:40 Setup pyenv: 08:59:40 + export PYENV_ROOT=/opt/pyenv 08:59:40 + PYENV_ROOT=/opt/pyenv 08:59:40 + 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 08:59:40 + 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 08:59:40 + pyenv versions 08:59:40 system 08:59:40 3.8.13 08:59:40 3.9.13 08:59:40 3.10.13 08:59:40 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:59:40 + command -v pyenv 08:59:40 ++ pyenv init - --no-rehash 08:59:40 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 08:59:40 for i in ${!paths[@]}; do 08:59:40 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 08:59:40 fi; done; 08:59:40 echo "${paths[*]}"'\'')" 08:59:40 export PATH="/opt/pyenv/shims:${PATH}" 08:59:40 export PYENV_SHELL=bash 08:59:40 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 08:59:40 pyenv() { 08:59:40 local command 08:59:40 command="${1:-}" 08:59:40 if [ "$#" -gt 0 ]; then 08:59:40 shift 08:59:40 fi 08:59:40 08:59:40 case "$command" in 08:59:40 rehash|shell) 08:59:40 eval "$(pyenv "sh-$command" "$@")" 08:59:40 ;; 08:59:40 *) 08:59:40 command pyenv "$command" "$@" 08:59:40 ;; 08:59:40 esac 08:59:40 }' 08:59:40 +++ bash --norc -ec 'IFS=:; paths=($PATH); 08:59:40 for i in ${!paths[@]}; do 08:59:40 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 08:59:40 fi; done; 08:59:40 echo "${paths[*]}"' 08:59:40 ++ 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 08:59:40 ++ 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 08:59:40 ++ 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 08:59:40 ++ export PYENV_SHELL=bash 08:59:40 ++ PYENV_SHELL=bash 08:59:40 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 08:59:40 +++ complete -F _pyenv pyenv 08:59:40 ++ lf-pyver python3 08:59:40 ++ local py_version_xy=python3 08:59:40 ++ local py_version_xyz= 08:59:40 ++ pyenv versions 08:59:40 ++ local command 08:59:40 ++ command=versions 08:59:40 ++ '[' 1 -gt 0 ']' 08:59:40 ++ shift 08:59:40 ++ case "$command" in 08:59:40 ++ command pyenv versions 08:59:40 ++ pyenv versions 08:59:40 ++ sed 's/^[ *]* //' 08:59:40 ++ awk '{ print $1 }' 08:59:40 ++ grep -E '^[0-9.]*[0-9]$' 08:59:40 ++ [[ ! -s /tmp/.pyenv_versions ]] 08:59:40 +++ grep '^3' /tmp/.pyenv_versions 08:59:40 +++ sort -V 08:59:40 +++ tail -n 1 08:59:40 ++ py_version_xyz=3.11.7 08:59:40 ++ [[ -z 3.11.7 ]] 08:59:40 ++ echo 3.11.7 08:59:40 ++ return 0 08:59:40 + pyenv local 3.11.7 08:59:40 + local command 08:59:40 + command=local 08:59:40 + '[' 2 -gt 0 ']' 08:59:40 + shift 08:59:40 + case "$command" in 08:59:40 + command pyenv local 3.11.7 08:59:40 + pyenv local 3.11.7 08:59:40 + for arg in "$@" 08:59:40 + case $arg in 08:59:40 + pkg_list+='tox ' 08:59:40 + for arg in "$@" 08:59:40 + case $arg in 08:59:40 + pkg_list+='virtualenv ' 08:59:40 + for arg in "$@" 08:59:40 + case $arg in 08:59:40 + pkg_list+='urllib3~=1.26.15 ' 08:59:40 + [[ -f /tmp/.toxenv ]] 08:59:40 + [[ ! -f /tmp/.toxenv ]] 08:59:40 + [[ -n '' ]] 08:59:40 + python3 -m venv /tmp/venv-bSiN 08:59:44 + echo 'lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-bSiN' 08:59:44 lf-activate-venv(): INFO: Creating python3 venv at /tmp/venv-bSiN 08:59:44 + echo /tmp/venv-bSiN 08:59:44 + echo 'lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv' 08:59:44 lf-activate-venv(): INFO: Save venv in file: /tmp/.toxenv 08:59:44 + /tmp/venv-bSiN/bin/python3 -m pip install --upgrade --quiet pip virtualenv 08:59:47 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 08:59:47 + echo 'lf-activate-venv(): INFO: Installing: tox virtualenv urllib3~=1.26.15 ' 08:59:47 lf-activate-venv(): INFO: Installing: tox virtualenv urllib3~=1.26.15 08:59:47 + /tmp/venv-bSiN/bin/python3 -m pip install --upgrade --quiet --upgrade-strategy eager tox virtualenv urllib3~=1.26.15 08:59:50 + type python3 08:59:50 + true 08:59:50 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-bSiN/bin to PATH' 08:59:50 lf-activate-venv(): INFO: Adding /tmp/venv-bSiN/bin to PATH 08:59:50 + PATH=/tmp/venv-bSiN/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 08:59:50 + return 0 08:59:50 + python3 --version 08:59:50 Python 3.11.7 08:59:50 + python3 -m pip --version 08:59:50 pip 24.2 from /tmp/venv-bSiN/lib/python3.11/site-packages/pip (python 3.11) 08:59:50 + python3 -m pip freeze 08:59:51 cachetools==5.5.0 08:59:51 chardet==5.2.0 08:59:51 colorama==0.4.6 08:59:51 distlib==0.3.9 08:59:51 filelock==3.16.1 08:59:51 packaging==24.1 08:59:51 platformdirs==4.3.6 08:59:51 pluggy==1.5.0 08:59:51 pyproject-api==1.8.0 08:59:51 tox==4.23.0 08:59:51 urllib3==1.26.20 08:59:51 virtualenv==20.27.0 08:59:51 [transportpce-tox-verify-transportpce-master] $ /bin/sh -xe /tmp/jenkins5792965793975146347.sh 08:59:51 [EnvInject] - Injecting environment variables from a build step. 08:59:51 [EnvInject] - Injecting as environment variables the properties content 08:59:51 PARALLEL=True 08:59:51 08:59:51 [EnvInject] - Variables injected successfully. 08:59:51 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins4222465903241905992.sh 08:59:51 ---> tox-run.sh 08:59:51 + 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 08:59:51 + ARCHIVE_TOX_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 08:59:51 + ARCHIVE_DOC_DIR=/w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 08:59:51 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox 08:59:51 + cd /w/workspace/transportpce-tox-verify-transportpce-master/. 08:59:51 + source /home/jenkins/lf-env.sh 08:59:51 + lf-activate-venv --venv-file /tmp/.toxenv tox virtualenv urllib3~=1.26.15 08:59:51 ++ mktemp -d /tmp/venv-XXXX 08:59:51 + lf_venv=/tmp/venv-eXqC 08:59:51 + local venv_file=/tmp/.os_lf_venv 08:59:51 + local python=python3 08:59:51 + local options 08:59:51 + local set_path=true 08:59:51 + local install_args= 08:59:51 ++ 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 08:59:51 + options=' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 08:59:51 + eval set -- ' --venv-file '\''/tmp/.toxenv'\'' -- '\''tox'\'' '\''virtualenv'\'' '\''urllib3~=1.26.15'\''' 08:59:51 ++ set -- --venv-file /tmp/.toxenv -- tox virtualenv urllib3~=1.26.15 08:59:51 + true 08:59:51 + case $1 in 08:59:51 + venv_file=/tmp/.toxenv 08:59:51 + shift 2 08:59:51 + true 08:59:51 + case $1 in 08:59:51 + shift 08:59:51 + break 08:59:51 + case $python in 08:59:51 + local pkg_list= 08:59:51 + [[ -d /opt/pyenv ]] 08:59:51 + echo 'Setup pyenv:' 08:59:51 Setup pyenv: 08:59:51 + export PYENV_ROOT=/opt/pyenv 08:59:51 + PYENV_ROOT=/opt/pyenv 08:59:51 + 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 08:59:51 + 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 08:59:51 + pyenv versions 08:59:51 system 08:59:51 3.8.13 08:59:51 3.9.13 08:59:51 3.10.13 08:59:51 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 08:59:51 + command -v pyenv 08:59:51 ++ pyenv init - --no-rehash 08:59:51 + eval 'PATH="$(bash --norc -ec '\''IFS=:; paths=($PATH); 08:59:51 for i in ${!paths[@]}; do 08:59:51 if [[ ${paths[i]} == "'\'''\''/opt/pyenv/shims'\'''\''" ]]; then unset '\''\'\'''\''paths[i]'\''\'\'''\''; 08:59:51 fi; done; 08:59:51 echo "${paths[*]}"'\'')" 08:59:51 export PATH="/opt/pyenv/shims:${PATH}" 08:59:51 export PYENV_SHELL=bash 08:59:51 source '\''/opt/pyenv/libexec/../completions/pyenv.bash'\'' 08:59:51 pyenv() { 08:59:51 local command 08:59:51 command="${1:-}" 08:59:51 if [ "$#" -gt 0 ]; then 08:59:51 shift 08:59:51 fi 08:59:51 08:59:51 case "$command" in 08:59:51 rehash|shell) 08:59:51 eval "$(pyenv "sh-$command" "$@")" 08:59:51 ;; 08:59:51 *) 08:59:51 command pyenv "$command" "$@" 08:59:51 ;; 08:59:51 esac 08:59:51 }' 08:59:51 +++ bash --norc -ec 'IFS=:; paths=($PATH); 08:59:51 for i in ${!paths[@]}; do 08:59:51 if [[ ${paths[i]} == "/opt/pyenv/shims" ]]; then unset '\''paths[i]'\''; 08:59:51 fi; done; 08:59:51 echo "${paths[*]}"' 08:59:51 ++ 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 08:59:51 ++ 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 08:59:51 ++ 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 08:59:51 ++ export PYENV_SHELL=bash 08:59:51 ++ PYENV_SHELL=bash 08:59:51 ++ source /opt/pyenv/libexec/../completions/pyenv.bash 08:59:51 +++ complete -F _pyenv pyenv 08:59:51 ++ lf-pyver python3 08:59:51 ++ local py_version_xy=python3 08:59:51 ++ local py_version_xyz= 08:59:51 ++ pyenv versions 08:59:51 ++ local command 08:59:51 ++ command=versions 08:59:51 ++ '[' 1 -gt 0 ']' 08:59:51 ++ shift 08:59:51 ++ case "$command" in 08:59:51 ++ command pyenv versions 08:59:51 ++ pyenv versions 08:59:51 ++ awk '{ print $1 }' 08:59:51 ++ grep -E '^[0-9.]*[0-9]$' 08:59:51 ++ sed 's/^[ *]* //' 08:59:51 ++ [[ ! -s /tmp/.pyenv_versions ]] 08:59:51 +++ grep '^3' /tmp/.pyenv_versions 08:59:51 +++ sort -V 08:59:51 +++ tail -n 1 08:59:51 ++ py_version_xyz=3.11.7 08:59:51 ++ [[ -z 3.11.7 ]] 08:59:51 ++ echo 3.11.7 08:59:51 ++ return 0 08:59:51 + pyenv local 3.11.7 08:59:51 + local command 08:59:51 + command=local 08:59:51 + '[' 2 -gt 0 ']' 08:59:51 + shift 08:59:51 + case "$command" in 08:59:51 + command pyenv local 3.11.7 08:59:51 + pyenv local 3.11.7 08:59:51 + for arg in "$@" 08:59:51 + case $arg in 08:59:51 + pkg_list+='tox ' 08:59:51 + for arg in "$@" 08:59:51 + case $arg in 08:59:51 + pkg_list+='virtualenv ' 08:59:51 + for arg in "$@" 08:59:51 + case $arg in 08:59:51 + pkg_list+='urllib3~=1.26.15 ' 08:59:51 + [[ -f /tmp/.toxenv ]] 08:59:51 ++ cat /tmp/.toxenv 08:59:51 + lf_venv=/tmp/venv-bSiN 08:59:51 + echo 'lf-activate-venv(): INFO: Reuse venv:/tmp/venv-bSiN from' file:/tmp/.toxenv 08:59:51 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-bSiN from file:/tmp/.toxenv 08:59:51 + /tmp/venv-bSiN/bin/python3 -m pip install --upgrade --quiet pip virtualenv 08:59:52 + [[ -z tox virtualenv urllib3~=1.26.15 ]] 08:59:52 + echo 'lf-activate-venv(): INFO: Installing: tox virtualenv urllib3~=1.26.15 ' 08:59:52 lf-activate-venv(): INFO: Installing: tox virtualenv urllib3~=1.26.15 08:59:52 + /tmp/venv-bSiN/bin/python3 -m pip install --upgrade --quiet --upgrade-strategy eager tox virtualenv urllib3~=1.26.15 08:59:53 + type python3 08:59:53 + true 08:59:53 + echo 'lf-activate-venv(): INFO: Adding /tmp/venv-bSiN/bin to PATH' 08:59:53 lf-activate-venv(): INFO: Adding /tmp/venv-bSiN/bin to PATH 08:59:53 + PATH=/tmp/venv-bSiN/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 08:59:53 + return 0 08:59:53 + [[ -d /opt/pyenv ]] 08:59:53 + echo '---> Setting up pyenv' 08:59:53 ---> Setting up pyenv 08:59:53 + export PYENV_ROOT=/opt/pyenv 08:59:53 + PYENV_ROOT=/opt/pyenv 08:59:53 + export PATH=/opt/pyenv/bin:/tmp/venv-bSiN/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 08:59:53 + PATH=/opt/pyenv/bin:/tmp/venv-bSiN/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 08:59:53 ++ pwd 08:59:53 + PYTHONPATH=/w/workspace/transportpce-tox-verify-transportpce-master 08:59:53 + export PYTHONPATH 08:59:53 + export TOX_TESTENV_PASSENV=PYTHONPATH 08:59:53 + TOX_TESTENV_PASSENV=PYTHONPATH 08:59:53 + tox --version 08:59:53 4.23.0 from /tmp/venv-bSiN/lib/python3.11/site-packages/tox/__init__.py 08:59:53 + PARALLEL=True 08:59:53 + TOX_OPTIONS_LIST= 08:59:53 + [[ -n '' ]] 08:59:53 + case ${PARALLEL,,} in 08:59:53 + TOX_OPTIONS_LIST=' --parallel auto --parallel-live' 08:59:53 + tox --parallel auto --parallel-live 08:59:53 + tee -a /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tox.log 08:59:55 docs: install_deps> python -I -m pip install -r docs/requirements.txt 08:59:55 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 08:59:55 docs-linkcheck: install_deps> python -I -m pip install -r docs/requirements.txt 08:59:55 checkbashisms: freeze> python -m pip freeze --all 08:59:55 checkbashisms: pip==24.2,setuptools==75.2.0,wheel==0.44.0 08:59:55 checkbashisms: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 08:59:55 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)' 08:59:55 checkbashisms: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find . -not -path '*/\.*' -name '*.sh' -exec checkbashisms -f '{}' + 08:59:56 script ./reflectwarn.sh does not appear to have a #! interpreter line; 08:59:56 you may get strange results 08:59:56 checkbashisms: OK ✔ in 2.81 seconds 08:59:56 pre-commit: install_deps> python -I -m pip install pre-commit 08:59:59 pre-commit: freeze> python -m pip freeze --all 08:59:59 pre-commit: cfgv==3.4.0,distlib==0.3.9,filelock==3.16.1,identify==2.6.1,nodeenv==1.9.1,pip==24.2,platformdirs==4.3.6,pre_commit==4.0.1,PyYAML==6.0.2,setuptools==75.2.0,virtualenv==20.27.0,wheel==0.44.0 08:59:59 pre-commit: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./fixCIcentOS8reposMirrors.sh 08:59:59 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)' 08:59:59 /usr/bin/cpan 08:59:59 pre-commit: commands[2] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run --all-files --show-diff-on-failure 09:00:00 [WARNING] hook id `remove-tabs` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:00:00 [WARNING] hook id `perltidy` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this. 09:00:00 [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. 09:00:00 [WARNING] repo `https://github.com/pre-commit/pre-commit-hooks` uses deprecated stage names (commit, push) which will be removed in a future version. Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this. if it does not -- consider reporting an issue to that repo. 09:00:00 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint. 09:00:00 [INFO] Initializing environment for https://github.com/jorisroovers/gitlint:./gitlint-core[trusted-deps]. 09:00:01 [INFO] Initializing environment for https://github.com/Lucas-C/pre-commit-hooks. 09:00:01 buildcontroller: freeze> python -m pip freeze --all 09:00:01 [INFO] Initializing environment for https://github.com/pre-commit/mirrors-autopep8. 09:00:01 buildcontroller: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:00:01 buildcontroller: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_controller.sh 09:00:01 + update-java-alternatives -l 09:00:01 java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64 09:00:01 java-1.12.0-openjdk-amd64 1211 /usr/lib/jvm/java-1.12.0-openjdk-amd64 09:00:01 java-1.17.0-openjdk-amd64 1711 /usr/lib/jvm/java-1.17.0-openjdk-amd64 09:00:01 java-1.21.0-openjdk-amd64 2111 /usr/lib/jvm/java-1.21.0-openjdk-amd64 09:00:01 + sudo update-java-alternatives -s java-1.21.0-openjdk-amd64 09:00:01 java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64 09:00:01 [INFO] Initializing environment for https://github.com/perltidy/perltidy. 09:00:02 + sed -n ;s/.* version "\(.*\)\.\(.*\)\..*".*$/\1/p; 09:00:02 + java -version 09:00:02 + JAVA_VER=21 09:00:02 + echo 21 09:00:02 21 09:00:02 + sed -n ;s/javac \(.*\)\.\(.*\)\..*.*$/\1/p; 09:00:02 + javac -version 09:00:02 [INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks. 09:00:02 [INFO] Once installed this environment will be reused. 09:00:02 [INFO] This may take a few minutes... 09:00:02 + JAVAC_VER=21 09:00:02 + echo 21 09:00:02 21 09:00:02 ok, java is 21 or newer 09:00:02 + [ 21 -ge 21 ] 09:00:02 + [ 21 -ge 21 ] 09:00:02 + echo ok, java is 21 or newer 09:00:02 + wget -nv https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz -P /tmp 09:00:03 2024-10-18 09:00:03 URL:https://dlcdn.apache.org/maven/maven-3/3.9.8/binaries/apache-maven-3.9.8-bin.tar.gz [9083702/9083702] -> "/tmp/apache-maven-3.9.8-bin.tar.gz" [1] 09:00:03 + sudo mkdir -p /opt 09:00:03 + sudo tar xf /tmp/apache-maven-3.9.8-bin.tar.gz -C /opt 09:00:04 + sudo ln -s /opt/apache-maven-3.9.8 /opt/maven 09:00:04 + sudo ln -s /opt/maven/bin/mvn /usr/bin/mvn 09:00:04 + mvn --version 09:00:04 Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256) 09:00:04 Maven home: /opt/maven 09:00:04 Java version: 21.0.4, vendor: Ubuntu, runtime: /usr/lib/jvm/java-21-openjdk-amd64 09:00:04 Default locale: en, platform encoding: UTF-8 09:00:04 OS name: "linux", version: "5.4.0-190-generic", arch: "amd64", family: "unix" 09:00:04 NOTE: Picked up JDK_JAVA_OPTIONS: 09:00:04 --add-opens=java.base/java.io=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.lang=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.net=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.nio=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.util=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:00:04 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:00:04 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:00:04 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:00:04 -Xlog:disable 09:00:06 [INFO] Installing environment for https://github.com/Lucas-C/pre-commit-hooks. 09:00:06 [INFO] Once installed this environment will be reused. 09:00:06 [INFO] This may take a few minutes... 09:00:12 [INFO] Installing environment for https://github.com/pre-commit/mirrors-autopep8. 09:00:12 [INFO] Once installed this environment will be reused. 09:00:12 [INFO] This may take a few minutes... 09:00:15 [INFO] Installing environment for https://github.com/perltidy/perltidy. 09:00:15 [INFO] Once installed this environment will be reused. 09:00:15 [INFO] This may take a few minutes... 09:00:23 docs-linkcheck: freeze> python -m pip freeze --all 09:00:23 docs: freeze> python -m pip freeze --all 09:00:23 docs: alabaster==1.0.0,attrs==24.2.0,babel==2.16.0,blockdiag==3.0.0,certifi==2024.8.30,charset-normalizer==3.4.0,contourpy==1.3.0,cycler==0.12.1,docutils==0.21.2,fonttools==4.54.1,funcparserlib==2.0.0a0,future==1.0.0,idna==3.10,imagesize==1.4.1,Jinja2==3.1.4,jsonschema==3.2.0,kiwisolver==1.4.7,lfdocs-conf==0.9.0,MarkupSafe==3.0.1,matplotlib==3.9.2,numpy==2.1.2,nwdiag==3.0.0,packaging==24.1,pillow==11.0.0,pip==24.2,Pygments==2.18.0,pyparsing==3.2.0,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.2,requests==2.32.3,requests-file==1.5.1,seqdiag==3.0.0,setuptools==75.2.0,six==1.16.0,snowballstemmer==2.2.0,Sphinx==8.1.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-rtd-theme==3.0.1,sphinx-tabs==3.4.7,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.30,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.2.3,webcolors==24.8.0,wheel==0.44.0 09:00:23 docs: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sphinx-build -q -W --keep-going -b html -n -d /w/workspace/transportpce-tox-verify-transportpce-master/.tox/docs/tmp/doctrees ../docs/ /w/workspace/transportpce-tox-verify-transportpce-master/docs/_build/html 09:00:23 docs-linkcheck: alabaster==1.0.0,attrs==24.2.0,babel==2.16.0,blockdiag==3.0.0,certifi==2024.8.30,charset-normalizer==3.4.0,contourpy==1.3.0,cycler==0.12.1,docutils==0.21.2,fonttools==4.54.1,funcparserlib==2.0.0a0,future==1.0.0,idna==3.10,imagesize==1.4.1,Jinja2==3.1.4,jsonschema==3.2.0,kiwisolver==1.4.7,lfdocs-conf==0.9.0,MarkupSafe==3.0.1,matplotlib==3.9.2,numpy==2.1.2,nwdiag==3.0.0,packaging==24.1,pillow==11.0.0,pip==24.2,Pygments==2.18.0,pyparsing==3.2.0,pyrsistent==0.20.0,python-dateutil==2.9.0.post0,PyYAML==6.0.2,requests==2.32.3,requests-file==1.5.1,seqdiag==3.0.0,setuptools==75.2.0,six==1.16.0,snowballstemmer==2.2.0,Sphinx==8.1.3,sphinx-bootstrap-theme==0.8.1,sphinx-data-viewer==0.1.5,sphinx-rtd-theme==3.0.1,sphinx-tabs==3.4.7,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.30,sphinxcontrib-qthelp==2.0.0,sphinxcontrib-seqdiag==3.0.0,sphinxcontrib-serializinghtml==2.0.0,sphinxcontrib-swaggerdoc==0.1.7,urllib3==2.2.3,webcolors==24.8.0,wheel==0.44.0 09:00:23 docs-linkcheck: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> sphinx-build -q -b linkcheck -d /w/workspace/transportpce-tox-verify-transportpce-master/.tox/docs-linkcheck/tmp/doctrees ../docs/ /w/workspace/transportpce-tox-verify-transportpce-master/docs/_build/linkcheck 09:00:25 docs: OK ✔ in 31.44 seconds 09:00:25 pylint: install_deps> python -I -m pip install 'pylint>=2.6.0' 09:00:27 trim trailing whitespace.................................................Passed 09:00:27 Tabs remover.............................................................Passed 09:00:27 autopep8.................................................................docs-linkcheck: OK ✔ in 32.58 seconds 09:00:30 pylint: freeze> python -m pip freeze --all 09:00:31 pylint: astroid==3.3.5,dill==0.3.9,isort==5.13.2,mccabe==0.7.0,pip==24.2,platformdirs==4.3.6,pylint==3.3.1,setuptools==75.2.0,tomlkit==0.13.2,wheel==0.44.0 09:00:31 pylint: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> find transportpce_tests/ -name '*.py' -exec pylint --fail-under=10 --max-line-length=120 --disable=missing-docstring,import-error --disable=fixme --disable=duplicate-code '--module-rgx=([a-z0-9_]+$)|([0-9.]{1,30}$)' '--method-rgx=(([a-z_][a-zA-Z0-9_]{2,})|(_[a-z0-9_]*)|(__[a-zA-Z][a-zA-Z0-9_]+__))$' '--variable-rgx=[a-zA-Z_][a-zA-Z0-9_]{1,30}$' '{}' + 09:00:31 Passed 09:00:32 perltidy.................................................................Passed 09:00:32 pre-commit: commands[3] /w/workspace/transportpce-tox-verify-transportpce-master/tests> pre-commit run gitlint-ci --hook-stage manual 09:00: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. 09:00: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. 09:00:33 [INFO] Installing environment for https://github.com/jorisroovers/gitlint. 09:00:33 [INFO] Once installed this environment will be reused. 09:00:33 [INFO] This may take a few minutes... 09:00:40 gitlint..................................................................Passed 09:00:51 ************* Module 1.2.1.test03_topology 09:00:51 transportpce_tests/1.2.1/test03_topology.py:430:4: R0912: Too many branches (13/12) (too-many-branches) 09:00:51 ************* Module tapi.test03_tapi_device_change_notifications 09:00:51 transportpce_tests/tapi/test03_tapi_device_change_notifications.py:14:0: C0302: Too many lines in module (1003/1000) (too-many-lines) 09:00:51 ************* Module 2.2.1.test04_otn_topology 09:00:51 transportpce_tests/2.2.1/test04_otn_topology.py:120:4: R0912: Too many branches (13/12) (too-many-branches) 09:00:51 09:00:51 ------------------------------------ 09:00:51 Your code has been rated at 10.00/10 09:00:51 09:00:52 pre-commit: OK ✔ in 43.54 seconds 09:00:52 pylint: exit 1 (21.38 seconds) /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}$' '{}' + pid=30059 09:01:47 pylint: FAIL ✖ in 27.55 seconds 09:01:47 buildcontroller: OK ✔ in 1 minute 52.71 seconds 09:01:47 build_karaf_tests121: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:01:47 sims: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:01:47 build_karaf_tests221: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:01:47 testsPCE: install_deps> python -I -m pip install gnpy4tpce==2.4.7 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:01:53 sims: freeze> python -m pip freeze --all 09:01:53 build_karaf_tests121: freeze> python -m pip freeze --all 09:01:53 build_karaf_tests221: freeze> python -m pip freeze --all 09:01:53 sims: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:01:53 sims: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./install_lightynode.sh 09:01:53 Using lighynode version 20.1.0.2 09:01:53 Installing lightynode device to ./lightynode/lightynode-openroadm-device directory 09:01:53 build_karaf_tests121: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:01:53 build_karaf_tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:01:53 NOTE: Picked up JDK_JAVA_OPTIONS: 09:01:53 --add-opens=java.base/java.io=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.net=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:01:53 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:01:53 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:01:53 -Xlog:disable 09:01:53 build_karaf_tests221: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:01:53 build_karaf_tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:01:53 NOTE: Picked up JDK_JAVA_OPTIONS: 09:01:53 --add-opens=java.base/java.io=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.net=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:01:53 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:01:53 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:01:53 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:01:53 -Xlog:disable 09:01:59 sims: OK ✔ in 10.74 seconds 09:01:59 build_karaf_tests71: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:02:10 build_karaf_tests71: freeze> python -m pip freeze --all 09:02:11 build_karaf_tests71: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:02:11 build_karaf_tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:02:11 NOTE: Picked up JDK_JAVA_OPTIONS: 09:02:11 --add-opens=java.base/java.io=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.lang=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.net=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.nio=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.util=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:02:11 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:02:11 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:02:11 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:02:11 -Xlog:disable 09:02:38 build_karaf_tests121: OK ✔ in 50.98 seconds 09:02:38 build_karaf_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 09:02:40 build_karaf_tests221: OK ✔ in 53.42 seconds 09:02:40 tests_tapi: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:02:44 build_karaf_tests_hybrid: freeze> python -m pip freeze --all 09:02:45 build_karaf_tests_hybrid: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:02:45 build_karaf_tests_hybrid: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./build_karaf_for_tests.sh 09:02:45 NOTE: Picked up JDK_JAVA_OPTIONS: 09:02:45 --add-opens=java.base/java.io=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.lang=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.lang.invoke=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.lang.reflect=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.net=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.nio=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.nio.charset=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.nio.file=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.util=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.util.jar=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.util.stream=ALL-UNNAMED 09:02:45 --add-opens=java.base/java.util.zip=ALL-UNNAMED 09:02:45 --add-opens java.base/sun.nio.ch=ALL-UNNAMED 09:02:45 --add-opens java.base/sun.nio.fs=ALL-UNNAMED 09:02:45 -Xlog:disable 09:02:45 tests_tapi: freeze> python -m pip freeze --all 09:02:46 tests_tapi: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:02:46 tests_tapi: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh tapi 09:02:46 using environment variables from ./karaf221.env 09:02:46 pytest -q transportpce_tests/tapi/test01_abstracted_topology.py 09:03:05 build_karaf_tests71: OK ✔ in 1 minute 3.77 seconds 09:03:05 testsPCE: freeze> python -m pip freeze --all 09:03:06 testsPCE: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,click==8.1.7,contourpy==1.3.0,cryptography==3.3.2,cycler==0.12.1,dict2xml==1.7.6,Flask==2.1.3,Flask-Injector==0.14.0,fonttools==4.54.1,gnpy4tpce==2.4.7,idna==3.10,iniconfig==2.0.0,injector==0.22.0,itsdangerous==2.2.0,Jinja2==3.1.4,kiwisolver==1.4.7,lxml==5.3.0,MarkupSafe==3.0.1,matplotlib==3.9.2,netconf-client==3.1.1,networkx==2.8.8,numpy==1.26.4,packaging==24.1,pandas==1.5.3,paramiko==3.5.0,pbr==5.11.1,pillow==11.0.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pyparsing==3.2.0,pytest==8.3.3,python-dateutil==2.9.0.post0,pytz==2024.2,requests==2.32.3,scipy==1.14.1,setuptools==50.3.2,six==1.16.0,urllib3==2.2.3,Werkzeug==2.0.3,wheel==0.44.0,xlrd==1.2.0 09:03:06 testsPCE: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh pce 09:03:06 pytest -q transportpce_tests/pce/test01_pce.py 09:04:02 ................................... [100%] 09:05:06 20 passed in 119.34s (0:01:59) 09:05:06 pytest -q transportpce_tests/pce/test02_pce_400G.py 09:05:07 .......................... [100%] 09:05:47 9 passed in 40.58s 09:05:47 pytest -q transportpce_tests/pce/test03_gnpy.py 09:06:01 ............. [100%] 09:06:24 8 passed in 37.29s 09:06:24 pytest -q transportpce_tests/pce/test04_pce_bug_fix.py 09:06:25 .......... [100%] 09:07:01 3 passed in 36.27s 09:07:01 build_karaf_tests_hybrid: OK ✔ in 59.55 seconds 09:07:01 testsPCE: OK ✔ in 5 minutes 14.7 seconds 09:07:01 tests121: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:07:07 tests121: freeze> python -m pip freeze --all 09:07:07 tests121: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:07:07 tests121: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 09:07:07 using environment variables from ./karaf121.env 09:07:07 pytest -q transportpce_tests/1.2.1/test01_portmapping.py 09:09:45 .......................... [100%] 09:11:29 21 passed in 261.67s (0:04:21) 09:11:29 pytest -q transportpce_tests/1.2.1/test02_topo_portmapping.py 09:12:46 . [100%] 09:12:50 50 passed in 603.84s (0:10:03) 09:12:50 pytest -q transportpce_tests/tapi/test02_full_topology.py 09:13:54 ...................... [100%] 09:15:10 6 passed in 220.94s (0:03:40) 09:15:10 pytest -q transportpce_tests/1.2.1/test03_topology.py 09:15:29 .............. [100%] 09:17:22 30 passed in 272.30s (0:04:32) 09:17:22 pytest -q transportpce_tests/tapi/test03_tapi_device_change_notifications.py 09:18:22 .......................................................................................... [100%] 09:24:53 70 passed in 450.43s (0:07:30) 09:24:53 tests_tapi: OK ✔ in 22 minutes 13.45 seconds 09:24:53 tests71: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:24:58 tests71: freeze> python -m pip freeze --all 09:24:59 tests71: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:24:59 tests71: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 7.1 09:24:59 using environment variables from ./karaf71.env 09:24:59 pytest -q transportpce_tests/7.1/test01_portmapping.py 09:25:28 ................. [100%] 09:25:41 12 passed in 42.15s 09:25:41 pytest -q transportpce_tests/7.1/test02_otn_renderer.py 09:25:42 ........................... [100%] 09:26:22 44 passed in 671.26s (0:11:11) 09:26:22 pytest -q transportpce_tests/1.2.1/test04_renderer_service_path_nominal.py 09:26:23 ...................................................... [100%] 09:28:16 62 passed in 155.09s (0:02:35) 09:28:16 pytest -q transportpce_tests/7.1/test03_renderer_or_modes.py 09:28:47 ................................................................... [100%] 09:30:31 48 passed in 134.81s (0:02:14) 09:30:31 pytest -q transportpce_tests/7.1/test04_renderer_regen_mode.py 09:30:32 ..... [100%] 09:30:42 24 passed in 260.30s (0:04:20) 09:30:42 pytest -q transportpce_tests/1.2.1/test05_olm.py 09:31:02 ...................... [100%] 09:31:50 22 passed in 78.49s (0:01:18) 09:31:50 tests71: OK ✔ in 6 minutes 57.19 seconds 09:31:50 tests221: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:31:56 tests221: freeze> python -m pip freeze --all 09:31:56 tests221: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:31:56 tests221: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 2.2.1 09:31:56 using environment variables from ./karaf221.env 09:31:56 pytest -q transportpce_tests/2.2.1/test01_portmapping.py 09:32:32 ................................... [100%] 09:33:12 35 passed in 75.22s (0:01:15) 09:33:12 pytest -q transportpce_tests/2.2.1/test02_topo_portmapping.py 09:33:42 ...... [100%] 09:33:56 6 passed in 43.78s 09:33:56 pytest -q transportpce_tests/2.2.1/test03_topology.py 09:34:27 ..F..F.FFF.......F..F...........FF...FF....FF [100%] 09:36:11 =================================== FAILURES =================================== 09:36:11 __________________ TransportPCEtesting.test_02_getClliNetwork __________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_02_getClliNetwork(self): 09:36:11 response = test_utils.get_ietf_network_request('clli-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 logging.info(response) 09:36:11 > self.assertEqual(response['network'][0]['node'][0]['node-id'], 'NodeA') 09:36:11 E AssertionError: 'NodeC' != 'NodeA' 09:36:11 E - NodeC 09:36:11 E ? ^ 09:36:11 E + NodeA 09:36:11 E ? ^ 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:124: AssertionError 09:36:11 ____________ TransportPCEtesting.test_05_getNodes_OpenRoadmTopology ____________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_05_getNodes_OpenRoadmTopology(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 5) 09:36:11 E AssertionError: 6 != 5 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:166: AssertionError 09:36:11 __________________ TransportPCEtesting.test_07_getClliNetwork __________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_07_getClliNetwork(self): 09:36:11 response = test_utils.get_ietf_network_request('clli-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(response['network'][0]['node'][0]['node-id'], 'NodeA') 09:36:11 E AssertionError: 'NodeC' != 'NodeA' 09:36:11 E - NodeC 09:36:11 E ? ^ 09:36:11 E + NodeA 09:36:11 E ? ^ 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:193: AssertionError 09:36:11 _______________ TransportPCEtesting.test_08_getOpenRoadmNetwork ________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_08_getOpenRoadmNetwork(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 nbNode = len(response['network'][0]['node']) 09:36:11 > self.assertEqual(nbNode, 3) 09:36:11 E AssertionError: 4 != 3 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:201: AssertionError 09:36:11 ____________ TransportPCEtesting.test_09_getNodes_OpenRoadmTopology ____________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_09_getNodes_OpenRoadmTopology(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 6) 09:36:11 E AssertionError: 7 != 6 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:222: AssertionError 09:36:11 _______________ TransportPCEtesting.test_17_getOpenRoadmNetwork ________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_17_getOpenRoadmNetwork(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 nbNode = len(response['network'][0]['node']) 09:36:11 > self.assertEqual(nbNode, 4) 09:36:11 E AssertionError: 5 != 4 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:360: AssertionError 09:36:11 ____________ TransportPCEtesting.test_20_getNodes_OpenRoadmTopology ____________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_20_getNodes_OpenRoadmTopology(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 9) 09:36:11 E AssertionError: 10 != 9 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:441: AssertionError 09:36:11 ____________ TransportPCEtesting.test_32_getNodes_OpenRoadmTopology ____________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_32_getNodes_OpenRoadmTopology(self): 09:36:11 # pylint: disable=redundant-unittest-assert 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 6) 09:36:11 E AssertionError: 7 != 6 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:655: AssertionError 09:36:11 _______________ TransportPCEtesting.test_33_getOpenRoadmNetwork ________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_33_getOpenRoadmNetwork(self): 09:36:11 response = test_utils.get_ietf_network_request('openroadm-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 nbNode = len(response['network'][0]['node']) 09:36:11 > self.assertEqual(nbNode, 3) 09:36:11 E AssertionError: 4 != 3 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:702: AssertionError 09:36:11 _______________ TransportPCEtesting.test_37_getOpenRoadmNetwork ________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_37_getOpenRoadmNetwork(self): 09:36:11 response = test_utils.get_ietf_network_request('openroadm-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 2) 09:36:11 E AssertionError: 3 != 2 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:726: AssertionError 09:36:11 ____________ TransportPCEtesting.test_38_getNodes_OpenRoadmTopology ____________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_38_getNodes_OpenRoadmTopology(self): 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 5) 09:36:11 E AssertionError: 6 != 5 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:732: AssertionError 09:36:11 _______________ TransportPCEtesting.test_43_getOpenRoadmNetwork ________________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_43_getOpenRoadmNetwork(self): 09:36:11 response = test_utils.get_ietf_network_request('openroadm-network', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 # Only TAPI-SBI-ABS-NODE created at initialization shall remain in the topology 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 1) 09:36:11 E AssertionError: 2 != 1 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:815: AssertionError 09:36:11 ________ TransportPCEtesting.test_44_check_roadm2roadm_link_persistence ________ 09:36:11 09:36:11 self = 09:36:11 09:36:11 def test_44_check_roadm2roadm_link_persistence(self): 09:36:11 response = test_utils.get_ietf_network_request('openroadm-topology', 'config') 09:36:11 self.assertEqual(response['status_code'], requests.codes.ok) 09:36:11 # Only TAPI-SBI-ABS-NODE created at initialization shall remain in the topology 09:36:11 > self.assertEqual(len(response['network'][0]['node']), 1) 09:36:11 E AssertionError: 2 != 1 09:36:11 09:36:11 transportpce_tests/2.2.1/test03_topology.py:821: AssertionError 09:36:11 --------------------------- Captured stdout teardown --------------------------- 09:36:11 all processes killed 09:36:11 =========================== short test summary info ============================ 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_02_getClliNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_05_getNodes_OpenRoadmTopology 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_07_getClliNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_08_getOpenRoadmNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_09_getNodes_OpenRoadmTopology 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_17_getOpenRoadmNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_20_getNodes_OpenRoadmTopology 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_32_getNodes_OpenRoadmTopology 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_33_getOpenRoadmNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_37_getOpenRoadmNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_38_getNodes_OpenRoadmTopology 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_43_getOpenRoadmNetwork 09:36:11 FAILED transportpce_tests/2.2.1/test03_topology.py::TransportPCEtesting::test_44_check_roadm2roadm_link_persistence 09:36:11 13 failed, 31 passed in 135.12s (0:02:15) 09:36:11 tests221: exit 1 (254.83 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 2.2.1 pid=44774 09:37:29 .FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF [100%] 09:38:17 =================================== FAILURES =================================== 09:38:17 ______________ TransportOlmTesting.test_03_rdmA_device_connected _______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'PUT' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:38:17 body = '{"node": [{"node-id": "ROADMA01", "netconf-node-topology:host": "127.0.0.1", "netconf-node-topology:port": "17821", "...lis": "60000", "netconf-node-topology:max-connection-attempts": "0", "netconf-node-topology:keepalive-delay": "120"}]}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '589', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'PUT' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_03_rdmA_device_connected(self): 09:38:17 > response = test_utils.mount_device("ROADMA01", ('roadma-full', self.NODE_VERSION)) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:60: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:344: in mount_device 09:38:17 response = put_request(url[RESTCONF_VERSION].format('{}', node), body) 09:38:17 transportpce_tests/common/test_utils.py:124: in put_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_03_rdmA_device_connected 09:38:17 ______________ TransportOlmTesting.test_04_rdmC_device_connected _______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'PUT' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01' 09:38:17 body = '{"node": [{"node-id": "ROADMC01", "netconf-node-topology:host": "127.0.0.1", "netconf-node-topology:port": "17823", "...lis": "60000", "netconf-node-topology:max-connection-attempts": "0", "netconf-node-topology:keepalive-delay": "120"}]}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '589', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'PUT' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_04_rdmC_device_connected(self): 09:38:17 > response = test_utils.mount_device("ROADMC01", ('roadmc-full', self.NODE_VERSION)) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:64: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:344: in mount_device 09:38:17 response = put_request(url[RESTCONF_VERSION].format('{}', node), body) 09:38:17 transportpce_tests/common/test_utils.py:124: in put_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_04_rdmC_device_connected 09:38:17 _____________ TransportOlmTesting.test_05_connect_xpdrA_to_roadmA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRA01", "xpdr-num": "1", "network-num": "1", "rdm-node": "ROADMA01", "srg-num": "1", "termination-point-num": "SRG1-PP1-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-xpdr-rdm-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_05_connect_xpdrA_to_roadmA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-xpdr-rdm-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRA01', 'xpdr-num': '1', 'network-num': '1', 09:38:17 'rdm-node': 'ROADMA01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:68: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_05_connect_xpdrA_to_roadmA 09:38:17 _____________ TransportOlmTesting.test_06_connect_roadmA_to_xpdrA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRA01", "xpdr-num": "1", "network-num": "1", "rdm-node": "ROADMA01", "srg-num": "1", "termination-point-num": "SRG1-PP1-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-rdm-xpdr-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_06_connect_roadmA_to_xpdrA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-rdm-xpdr-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRA01', 'xpdr-num': '1', 'network-num': '1', 09:38:17 'rdm-node': 'ROADMA01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:75: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_06_connect_roadmA_to_xpdrA 09:38:17 _____________ TransportOlmTesting.test_07_connect_xpdrC_to_roadmC ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRC01", "xpdr-num": "1", "network-num": "1", "rdm-node": "ROADMC01", "srg-num": "1", "termination-point-num": "SRG1-PP1-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-xpdr-rdm-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_07_connect_xpdrC_to_roadmC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-xpdr-rdm-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRC01', 'xpdr-num': '1', 'network-num': '1', 09:38:17 'rdm-node': 'ROADMC01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:82: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_07_connect_xpdrC_to_roadmC 09:38:17 _____________ TransportOlmTesting.test_08_connect_roadmC_to_xpdrC ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRC01", "xpdr-num": "1", "network-num": "1", "rdm-node": "ROADMC01", "srg-num": "1", "termination-point-num": "SRG1-PP1-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-rdm-xpdr-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_08_connect_roadmC_to_xpdrC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-rdm-xpdr-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRC01', 'xpdr-num': '1', 'network-num': '1', 09:38:17 'rdm-node': 'ROADMC01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP1-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:89: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_08_connect_roadmC_to_xpdrC 09:38:17 ________________ TransportOlmTesting.test_09_create_OTS_ROADMA _________________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:create-ots-oms' 09:38:17 body = '{"input": {"node-id": "ROADMA01", "logical-connection-point": "DEG1-TTP-TXRX"}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '79', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:create-ots-oms', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:create-ots-oms' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:create-ots-oms (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_09_create_OTS_ROADMA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'create-ots-oms', 09:38:17 { 09:38:17 'node-id': 'ROADMA01', 09:38:17 'logical-connection-point': 'DEG1-TTP-TXRX' 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:96: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:create-ots-oms (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_09_create_OTS_ROADMA 09:38:17 ________________ TransportOlmTesting.test_10_create_OTS_ROADMC _________________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:create-ots-oms' 09:38:17 body = '{"input": {"node-id": "ROADMC01", "logical-connection-point": "DEG2-TTP-TXRX"}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '79', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:create-ots-oms', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:create-ots-oms' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:create-ots-oms (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_10_create_OTS_ROADMC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'create-ots-oms', 09:38:17 { 09:38:17 'node-id': 'ROADMC01', 09:38:17 'logical-connection-point': 'DEG2-TTP-TXRX' 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:105: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:create-ots-oms (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_10_create_OTS_ROADMC 09:38:17 __________________ TransportOlmTesting.test_11_get_PM_ROADMA ___________________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:get-pm' 09:38:17 body = '{"input": {"node-id": "ROADMA01", "resource-type": "interface", "granularity": "15min", "resource-identifier": {"resource-name": "OTS-DEG1-TTP-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '151', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:get-pm', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:get-pm' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:get-pm (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_11_get_PM_ROADMA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'get-pm', 09:38:17 { 09:38:17 'node-id': 'ROADMA01', 09:38:17 'resource-type': 'interface', 09:38:17 'granularity': '15min', 09:38:17 'resource-identifier': { 09:38:17 'resource-name': 'OTS-DEG1-TTP-TXRX' 09:38:17 } 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:114: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:get-pm (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_11_get_PM_ROADMA 09:38:17 __________________ TransportOlmTesting.test_12_get_PM_ROADMC ___________________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:get-pm' 09:38:17 body = '{"input": {"node-id": "ROADMC01", "resource-type": "interface", "granularity": "15min", "resource-identifier": {"resource-name": "OTS-DEG2-TTP-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '151', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:get-pm', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:get-pm' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:get-pm (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_12_get_PM_ROADMC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'get-pm', 09:38:17 { 09:38:17 'node-id': 'ROADMC01', 09:38:17 'resource-type': 'interface', 09:38:17 'granularity': '15min', 09:38:17 'resource-identifier': { 09:38:17 'resource-name': 'OTS-DEG2-TTP-TXRX' 09:38:17 } 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:137: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:get-pm (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_12_get_PM_ROADMC 09:38:17 ______ TransportOlmTesting.test_13_calculate_span_loss_base_ROADMA_ROADMC ______ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-base' 09:38:17 body = '{"input": {"src-type": "link", "link-id": "ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX"}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '102', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:calculate-spanloss-base', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-base' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-base (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_13_calculate_span_loss_base_ROADMA_ROADMC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'calculate-spanloss-base', 09:38:17 { 09:38:17 'src-type': 'link', 09:38:17 'link-id': 'ROADMA01-DEG1-DEG1-TTP-TXRXtoROADMC01-DEG2-DEG2-TTP-TXRX' 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:160: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-base (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_13_calculate_span_loss_base_ROADMA_ROADMC 09:38:17 ___________ TransportOlmTesting.test_14_calculate_span_loss_base_all ___________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-base' 09:38:17 body = '{"input": {"src-type": "all"}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '30', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:calculate-spanloss-base', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-base' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-base (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_14_calculate_span_loss_base_all(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'calculate-spanloss-base', 09:38:17 { 09:38:17 'src-type': 'all' 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:176: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-base (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_14_calculate_span_loss_base_all 09:38:17 ___________ TransportOlmTesting.test_15_get_OTS_DEG1_TTP_TXRX_ROADMA ___________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG1-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...ice/interface=OTS-DEG1-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots', query='content=config', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG1-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG1-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_15_get_OTS_DEG1_TTP_TXRX_ROADMA(self): 09:38:17 > response = test_utils.check_node_attribute2_request( 09:38:17 'ROADMA01', 'interface', 'OTS-DEG1-TTP-TXRX', 'org-openroadm-optical-transport-interfaces:ots') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:195: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:421: in check_node_attribute2_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value, attribute2)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG1-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_15_get_OTS_DEG1_TTP_TXRX_ROADMA 09:38:17 ___________ TransportOlmTesting.test_16_get_OTS_DEG2_TTP_TXRX_ROADMC ___________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG2-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...ice/interface=OTS-DEG2-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots', query='content=config', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG2-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG2-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_16_get_OTS_DEG2_TTP_TXRX_ROADMC(self): 09:38:17 > response = test_utils.check_node_attribute2_request( 09:38:17 'ROADMC01', 'interface', 'OTS-DEG2-TTP-TXRX', 'org-openroadm-optical-transport-interfaces:ots') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:206: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:421: in check_node_attribute2_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value, attribute2)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=OTS-DEG2-TTP-TXRX/org-openroadm-optical-transport-interfaces:ots?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_16_get_OTS_DEG2_TTP_TXRX_ROADMC 09:38:17 _____________ TransportOlmTesting.test_17_servicePath_create_AToZ ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": "1", "modulation-format": "dp-qpsk", "operation": "create", "nodes"... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '593', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_17_servicePath_create_AToZ(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': '1', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'create', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRA01', 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 'src-tp': 'XPDR1-CLIENT1'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 'src-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'ROADMC01', 09:38:17 'dest-tp': 'SRG1-PP1-TXRX', 'src-tp': 'DEG2-TTP-TXRX'}, 09:38:17 {'node-id': 'XPDRC01', 09:38:17 'dest-tp': 'XPDR1-CLIENT1', 'src-tp': 'XPDR1-NETWORK1'}], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:213: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_17_servicePath_create_AToZ 09:38:17 _____________ TransportOlmTesting.test_18_servicePath_create_ZToA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": "1", "modulation-format": "dp-qpsk", "operation": "create", "nodes"... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '593', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_18_servicePath_create_ZToA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': '1', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'create', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRC01', 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 'src-tp': 'XPDR1-CLIENT1'}, 09:38:17 {'node-id': 'ROADMC01', 09:38:17 'dest-tp': 'DEG2-TTP-TXRX', 'src-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'src-tp': 'DEG1-TTP-TXRX', 'dest-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'XPDRA01', 09:38:17 'src-tp': 'XPDR1-NETWORK1', 'dest-tp': 'XPDR1-CLIENT1'}], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:241: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_18_servicePath_create_ZToA 09:38:17 _________ TransportOlmTesting.test_19_service_power_setup_XPDRA_XPDRC __________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:service-power-setup' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": 1, "nodes": [{"dest-tp": "XPDR1-NETWORK1", "src-tp": "XPDR1-CLIENT1... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '536', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:service-power-setup', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:service-power-setup' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-setup (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_19_service_power_setup_XPDRA_XPDRC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'service-power-setup', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': 1, 09:38:17 'nodes': [ 09:38:17 { 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 09:38:17 'src-tp': 'XPDR1-CLIENT1', 09:38:17 'node-id': 'XPDRA01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 09:38:17 'src-tp': 'SRG1-PP1-TXRX', 09:38:17 'node-id': 'ROADMA01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'SRG1-PP1-TXRX', 09:38:17 'src-tp': 'DEG2-TTP-TXRX', 09:38:17 'node-id': 'ROADMC01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'XPDR1-CLIENT1', 09:38:17 'src-tp': 'XPDR1-NETWORK1', 09:38:17 'node-id': 'XPDRC01' 09:38:17 } 09:38:17 ], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:269: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-setup (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_19_service_power_setup_XPDRA_XPDRC 09:38:17 ________ TransportOlmTesting.test_20_get_interface_XPDRA_XPDR1_NETWORK1 ________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog.../interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och', query='content=config', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_20_get_interface_XPDRA_XPDR1_NETWORK1(self): 09:38:17 > response = test_utils.check_node_attribute2_request( 09:38:17 'XPDRA01', 'interface', 'XPDR1-NETWORK1-761:768', 'org-openroadm-optical-channel-interfaces:och') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:307: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:421: in check_node_attribute2_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value, attribute2)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_20_get_interface_XPDRA_XPDR1_NETWORK1 09:38:17 ____________ TransportOlmTesting.test_21_get_roadmconnection_ROADMA ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768', query='content=nonconfig', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_21_get_roadmconnection_ROADMA(self): 09:38:17 > response = test_utils.check_node_attribute_request( 09:38:17 'ROADMA01', 'roadm-connections', 'SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:314: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:401: in check_node_attribute_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_21_get_roadmconnection_ROADMA 09:38:17 ____________ TransportOlmTesting.test_22_get_roadmconnection_ROADMC ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768', query='content=nonconfig', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_22_get_roadmconnection_ROADMC(self): 09:38:17 > response = test_utils.check_node_attribute_request( 09:38:17 'ROADMC01', 'roadm-connections', 'DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:321: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:401: in check_node_attribute_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_22_get_roadmconnection_ROADMC 09:38:17 _________ TransportOlmTesting.test_23_service_power_setup_XPDRC_XPDRA __________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:service-power-setup' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": 1, "nodes": [{"dest-tp": "XPDR1-NETWORK1", "src-tp": "XPDR1-CLIENT1... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '536', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:service-power-setup', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST', url = '/rests/operations/transportpce-olm:service-power-setup' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-setup (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_23_service_power_setup_XPDRC_XPDRA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'service-power-setup', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': 1, 09:38:17 'nodes': [ 09:38:17 { 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 09:38:17 'src-tp': 'XPDR1-CLIENT1', 09:38:17 'node-id': 'XPDRC01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'DEG2-TTP-TXRX', 09:38:17 'src-tp': 'SRG1-PP1-TXRX', 09:38:17 'node-id': 'ROADMC01' 09:38:17 }, 09:38:17 { 09:38:17 'src-tp': 'DEG1-TTP-TXRX', 09:38:17 'dest-tp': 'SRG1-PP1-TXRX', 09:38:17 'node-id': 'ROADMA01' 09:38:17 }, 09:38:17 { 09:38:17 'src-tp': 'XPDR1-NETWORK1', 09:38:17 'dest-tp': 'XPDR1-CLIENT1', 09:38:17 'node-id': 'XPDRA01' 09:38:17 } 09:38:17 ], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:327: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-setup (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_23_service_power_setup_XPDRC_XPDRA 09:38:17 ________ TransportOlmTesting.test_24_get_interface_XPDRC_XPDR1_NETWORK1 ________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog.../interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och', query='content=config', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_24_get_interface_XPDRC_XPDR1_NETWORK1(self): 09:38:17 > response = test_utils.check_node_attribute2_request( 09:38:17 'XPDRC01', 'interface', 'XPDR1-NETWORK1-761:768', 'org-openroadm-optical-channel-interfaces:och') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:365: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:421: in check_node_attribute2_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value, attribute2)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK1-761:768/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_24_get_interface_XPDRC_XPDR1_NETWORK1 09:38:17 ____________ TransportOlmTesting.test_25_get_roadmconnection_ROADMC ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768?content=nonconfig' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768', query='content=nonconfig', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768?content=nonconfig' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_25_get_roadmconnection_ROADMC(self): 09:38:17 > response = test_utils.check_node_attribute_request( 09:38:17 'ROADMC01', 'roadm-connections', 'SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:372: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:401: in check_node_attribute_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG2-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_25_get_roadmconnection_ROADMC 09:38:17 ________ TransportOlmTesting.test_26_service_power_turndown_XPDRA_XPDRC ________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:service-power-turndown' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": 1, "nodes": [{"dest-tp": "XPDR1-NETWORK1", "src-tp": "XPDR1-CLIENT1... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '536', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:service-power-turndown', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:service-power-turndown' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-turndown (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_26_service_power_turndown_XPDRA_XPDRC(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'service-power-turndown', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': 1, 09:38:17 'nodes': [ 09:38:17 { 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 09:38:17 'src-tp': 'XPDR1-CLIENT1', 09:38:17 'node-id': 'XPDRA01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 09:38:17 'src-tp': 'SRG1-PP1-TXRX', 09:38:17 'node-id': 'ROADMA01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'SRG1-PP1-TXRX', 09:38:17 'src-tp': 'DEG2-TTP-TXRX', 09:38:17 'node-id': 'ROADMC01' 09:38:17 }, 09:38:17 { 09:38:17 'dest-tp': 'XPDR1-CLIENT1', 09:38:17 'src-tp': 'XPDR1-NETWORK1', 09:38:17 'node-id': 'XPDRC01' 09:38:17 } 09:38:17 ], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:379: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:service-power-turndown (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_26_service_power_turndown_XPDRA_XPDRC 09:38:17 ____________ TransportOlmTesting.test_27_get_roadmconnection_ROADMA ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768', query='content=nonconfig', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_27_get_roadmconnection_ROADMA(self): 09:38:17 > response = test_utils.check_node_attribute_request( 09:38:17 'ROADMA01', 'roadm-connections', 'SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:417: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:401: in check_node_attribute_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=SRG1-PP1-TXRX-DEG1-TTP-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_27_get_roadmconnection_ROADMA 09:38:17 ____________ TransportOlmTesting.test_28_get_roadmconnection_ROADMC ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog...:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768', query='content=nonconfig', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_28_get_roadmconnection_ROADMC(self): 09:38:17 > response = test_utils.check_node_attribute_request( 09:38:17 'ROADMC01', 'roadm-connections', 'DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:424: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:401: in check_node_attribute_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01/yang-ext:mount/org-openroadm-device:org-openroadm-device/roadm-connections=DEG2-TTP-TXRX-SRG1-PP1-TXRX-761:768?content=nonconfig (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_28_get_roadmconnection_ROADMC 09:38:17 _____________ TransportOlmTesting.test_29_servicePath_delete_AToZ ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": "1", "modulation-format": "dp-qpsk", "operation": "delete", "nodes"... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '593', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_29_servicePath_delete_AToZ(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': '1', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'delete', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRA01', 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 'src-tp': 'XPDR1-CLIENT1'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 'src-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'ROADMC01', 09:38:17 'dest-tp': 'SRG1-PP1-TXRX', 'src-tp': 'DEG2-TTP-TXRX'}, 09:38:17 {'node-id': 'XPDRC01', 09:38:17 'dest-tp': 'XPDR1-CLIENT1', 'src-tp': 'XPDR1-NETWORK1'}], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:430: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_29_servicePath_delete_AToZ 09:38:17 _____________ TransportOlmTesting.test_30_servicePath_delete_ZToA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test", "wave-number": "1", "modulation-format": "dp-qpsk", "operation": "delete", "nodes"... 40, "min-freq": 196.075, "max-freq": 196.125, "lower-spectral-slot-number": 761, "higher-spectral-slot-number": 768}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '593', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_30_servicePath_delete_ZToA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test', 09:38:17 'wave-number': '1', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'delete', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRC01', 09:38:17 'dest-tp': 'XPDR1-NETWORK1', 'src-tp': 'XPDR1-CLIENT1'}, 09:38:17 {'node-id': 'ROADMC01', 09:38:17 'dest-tp': 'DEG2-TTP-TXRX', 'src-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'src-tp': 'DEG1-TTP-TXRX', 'dest-tp': 'SRG1-PP1-TXRX'}, 09:38:17 {'node-id': 'XPDRA01', 09:38:17 'src-tp': 'XPDR1-NETWORK1', 'dest-tp': 'XPDR1-CLIENT1'}], 09:38:17 'center-freq': 196.1, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.075, 09:38:17 'max-freq': 196.125, 09:38:17 'lower-spectral-slot-number': 761, 09:38:17 'higher-spectral-slot-number': 768 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:458: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_30_servicePath_delete_ZToA 09:38:17 _____________ TransportOlmTesting.test_31_connect_xpdrA_to_roadmA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRA01", "xpdr-num": "1", "network-num": "2", "rdm-node": "ROADMA01", "srg-num": "1", "termination-point-num": "SRG1-PP2-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-xpdr-rdm-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-xpdr-rdm-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_31_connect_xpdrA_to_roadmA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-xpdr-rdm-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRA01', 'xpdr-num': '1', 'network-num': '2', 09:38:17 'rdm-node': 'ROADMA01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP2-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:488: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-xpdr-rdm-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_31_connect_xpdrA_to_roadmA 09:38:17 _____________ TransportOlmTesting.test_32_connect_roadmA_to_xpdrA ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 body = '{"input": {"links-input": {"xpdr-node": "XPDRA01", "xpdr-num": "1", "network-num": "2", "rdm-node": "ROADMA01", "srg-num": "1", "termination-point-num": "SRG1-PP2-TXRX"}}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '171', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-networkutils:init-rdm-xpdr-links', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-networkutils:init-rdm-xpdr-links' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_32_connect_roadmA_to_xpdrA(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-networkutils', 'init-rdm-xpdr-links', 09:38:17 {'links-input': {'xpdr-node': 'XPDRA01', 'xpdr-num': '1', 'network-num': '2', 09:38:17 'rdm-node': 'ROADMA01', 'srg-num': '1', 'termination-point-num': 'SRG1-PP2-TXRX'}}) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:495: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-networkutils:init-rdm-xpdr-links (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_32_connect_roadmA_to_xpdrA 09:38:17 _____________ TransportOlmTesting.test_33_servicePath_create_AToZ ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test2", "wave-number": "2", "modulation-format": "dp-qpsk", "operation": "create", "nodes... 40, "min-freq": 196.025, "max-freq": 196.075, "lower-spectral-slot-number": 753, "higher-spectral-slot-number": 760}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '435', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_33_servicePath_create_AToZ(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test2', 09:38:17 'wave-number': '2', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'create', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRA01', 09:38:17 'dest-tp': 'XPDR1-NETWORK2', 'src-tp': 'XPDR1-CLIENT2'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 'src-tp': 'SRG1-PP2-TXRX'}], 09:38:17 'center-freq': 196.05, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.025, 09:38:17 'max-freq': 196.075, 09:38:17 'lower-spectral-slot-number': 753, 09:38:17 'higher-spectral-slot-number': 760 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:502: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_33_servicePath_create_AToZ 09:38:17 ________ TransportOlmTesting.test_34_get_interface_XPDRA_XPDR1_NETWORK2 ________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK2-753:760/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topolog.../interface=XPDR1-NETWORK2-753:760/org-openroadm-optical-channel-interfaces:och', query='content=config', fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'GET' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK2-753:760/org-openroadm-optical-channel-interfaces:och?content=config' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK2-753:760/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_34_get_interface_XPDRA_XPDR1_NETWORK2(self): 09:38:17 > response = test_utils.check_node_attribute2_request( 09:38:17 'XPDRA01', 'interface', 'XPDR1-NETWORK2-753:760', 'org-openroadm-optical-channel-interfaces:och') 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:526: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:421: in check_node_attribute2_request 09:38:17 response = get_request(url[RESTCONF_VERSION].format('{}', node, attribute, attribute_value, attribute2)) 09:38:17 transportpce_tests/common/test_utils.py:116: in get_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01/yang-ext:mount/org-openroadm-device:org-openroadm-device/interface=XPDR1-NETWORK2-753:760/org-openroadm-optical-channel-interfaces:och?content=config (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_34_get_interface_XPDRA_XPDR1_NETWORK2 09:38:17 _____________ TransportOlmTesting.test_35_servicePath_delete_AToZ ______________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 body = '{"input": {"service-name": "test2", "wave-number": "2", "modulation-format": "dp-qpsk", "operation": "delete", "nodes... 40, "min-freq": 196.025, "max-freq": 196.075, "lower-spectral-slot-number": 753, "higher-spectral-slot-number": 760}}' 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '435', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-device-renderer:service-path', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-device-renderer:service-path' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_35_servicePath_delete_AToZ(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-device-renderer', 'service-path', 09:38:17 { 09:38:17 'service-name': 'test2', 09:38:17 'wave-number': '2', 09:38:17 'modulation-format': 'dp-qpsk', 09:38:17 'operation': 'delete', 09:38:17 'nodes': 09:38:17 [{'node-id': 'XPDRA01', 09:38:17 'dest-tp': 'XPDR1-NETWORK2', 'src-tp': 'XPDR1-CLIENT2'}, 09:38:17 {'node-id': 'ROADMA01', 09:38:17 'dest-tp': 'DEG1-TTP-TXRX', 'src-tp': 'SRG1-PP2-TXRX'}], 09:38:17 'center-freq': 196.05, 09:38:17 'nmc-width': 40, 09:38:17 'min-freq': 196.025, 09:38:17 'max-freq': 196.075, 09:38:17 'lower-spectral-slot-number': 753, 09:38:17 'higher-spectral-slot-number': 760 09:38:17 }) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:533: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:142: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-device-renderer:service-path (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_35_servicePath_delete_AToZ 09:38:17 ____________ TransportOlmTesting.test_36_xpdrA_device_disconnected _____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_36_xpdrA_device_disconnected(self): 09:38:17 > response = test_utils.unmount_device("XPDRA01") 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:557: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:358: in unmount_device 09:38:17 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:38:17 transportpce_tests/common/test_utils.py:133: in delete_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_36_xpdrA_device_disconnected 09:38:17 ____________ TransportOlmTesting.test_37_xpdrC_device_disconnected _____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_37_xpdrC_device_disconnected(self): 09:38:17 > response = test_utils.unmount_device("XPDRC01") 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:561: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:358: in unmount_device 09:38:17 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:38:17 transportpce_tests/common/test_utils.py:133: in delete_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=XPDRC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_37_xpdrC_device_disconnected 09:38:17 ___________ TransportOlmTesting.test_38_calculate_span_loss_current ____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-current' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/operations/transportpce-olm:calculate-spanloss-current', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'POST' 09:38:17 url = '/rests/operations/transportpce-olm:calculate-spanloss-current' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-current (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_38_calculate_span_loss_current(self): 09:38:17 > response = test_utils.transportpce_api_rpc_request( 09:38:17 'transportpce-olm', 'calculate-spanloss-current', 09:38:17 None) 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:565: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:684: in transportpce_api_rpc_request 09:38:17 response = post_request(url, data) 09:38:17 transportpce_tests/common/test_utils.py:148: in post_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/operations/transportpce-olm:calculate-spanloss-current (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_38_calculate_span_loss_current 09:38:17 _____________ TransportOlmTesting.test_39_rdmA_device_disconnected _____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_39_rdmA_device_disconnected(self): 09:38:17 > response = test_utils.unmount_device("ROADMA01") 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:574: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:358: in unmount_device 09:38:17 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:38:17 transportpce_tests/common/test_utils.py:133: in delete_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMA01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_39_rdmA_device_disconnected 09:38:17 _____________ TransportOlmTesting.test_40_rdmC_device_disconnected _____________ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 > sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:199: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:85: in create_connection 09:38:17 raise err 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 address = ('localhost', 8182), timeout = 10, source_address = None 09:38:17 socket_options = [(6, 1, 1)] 09:38:17 09:38:17 def create_connection( 09:38:17 address: tuple[str, int], 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 source_address: tuple[str, int] | None = None, 09:38:17 socket_options: _TYPE_SOCKET_OPTIONS | None = None, 09:38:17 ) -> socket.socket: 09:38:17 """Connect to *address* and return the socket object. 09:38:17 09:38:17 Convenience function. Connect to *address* (a 2-tuple ``(host, 09:38:17 port)``) and return the socket object. Passing the optional 09:38:17 *timeout* parameter will set the timeout on the socket instance 09:38:17 before attempting to connect. If no *timeout* is supplied, the 09:38:17 global default timeout setting returned by :func:`socket.getdefaulttimeout` 09:38:17 is used. If *source_address* is set it must be a tuple of (host, port) 09:38:17 for the socket to bind as a source address before making the connection. 09:38:17 An host of '' or port 0 tells the OS to use the default. 09:38:17 """ 09:38:17 09:38:17 host, port = address 09:38:17 if host.startswith("["): 09:38:17 host = host.strip("[]") 09:38:17 err = None 09:38:17 09:38:17 # Using the value from allowed_gai_family() in the context of getaddrinfo lets 09:38:17 # us select whether to work with IPv4 DNS records, IPv6 records, or both. 09:38:17 # The original create_connection function always returns all records. 09:38:17 family = allowed_gai_family() 09:38:17 09:38:17 try: 09:38:17 host.encode("idna") 09:38:17 except UnicodeError: 09:38:17 raise LocationParseError(f"'{host}', label empty or too long") from None 09:38:17 09:38:17 for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): 09:38:17 af, socktype, proto, canonname, sa = res 09:38:17 sock = None 09:38:17 try: 09:38:17 sock = socket.socket(af, socktype, proto) 09:38:17 09:38:17 # If provided, set socket level options before connecting. 09:38:17 _set_socket_options(sock, socket_options) 09:38:17 09:38:17 if timeout is not _DEFAULT_TIMEOUT: 09:38:17 sock.settimeout(timeout) 09:38:17 if source_address: 09:38:17 sock.bind(source_address) 09:38:17 > sock.connect(sa) 09:38:17 E ConnectionRefusedError: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/connection.py:73: ConnectionRefusedError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01' 09:38:17 body = None 09:38:17 headers = {'User-Agent': 'python-requests/2.32.3', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'Content-Type': 'application/json', 'Content-Length': '0', 'Authorization': 'Basic YWRtaW46YWRtaW4='} 09:38:17 retries = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 redirect = False, assert_same_host = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), pool_timeout = None 09:38:17 release_conn = False, chunked = False, body_pos = None, preload_content = False 09:38:17 decode_content = False, response_kw = {} 09:38:17 parsed_url = Url(scheme=None, auth=None, host=None, port=None, path='/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01', query=None, fragment=None) 09:38:17 destination_scheme = None, conn = None, release_this_conn = True 09:38:17 http_tunnel_required = False, err = None, clean_exit = False 09:38:17 09:38:17 def urlopen( # type: ignore[override] 09:38:17 self, 09:38:17 method: str, 09:38:17 url: str, 09:38:17 body: _TYPE_BODY | None = None, 09:38:17 headers: typing.Mapping[str, str] | None = None, 09:38:17 retries: Retry | bool | int | None = None, 09:38:17 redirect: bool = True, 09:38:17 assert_same_host: bool = True, 09:38:17 timeout: _TYPE_TIMEOUT = _DEFAULT_TIMEOUT, 09:38:17 pool_timeout: int | None = None, 09:38:17 release_conn: bool | None = None, 09:38:17 chunked: bool = False, 09:38:17 body_pos: _TYPE_BODY_POSITION | None = None, 09:38:17 preload_content: bool = True, 09:38:17 decode_content: bool = True, 09:38:17 **response_kw: typing.Any, 09:38:17 ) -> BaseHTTPResponse: 09:38:17 """ 09:38:17 Get a connection from the pool and perform an HTTP request. This is the 09:38:17 lowest level call for making a request, so you'll need to specify all 09:38:17 the raw details. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 More commonly, it's appropriate to use a convenience method 09:38:17 such as :meth:`request`. 09:38:17 09:38:17 .. note:: 09:38:17 09:38:17 `release_conn` will only behave as expected if 09:38:17 `preload_content=False` because we want to make 09:38:17 `preload_content=False` the default behaviour someday soon without 09:38:17 breaking backwards compatibility. 09:38:17 09:38:17 :param method: 09:38:17 HTTP request method (such as GET, POST, PUT, etc.) 09:38:17 09:38:17 :param url: 09:38:17 The URL to perform the request on. 09:38:17 09:38:17 :param body: 09:38:17 Data to send in the request body, either :class:`str`, :class:`bytes`, 09:38:17 an iterable of :class:`str`/:class:`bytes`, or a file-like object. 09:38:17 09:38:17 :param headers: 09:38:17 Dictionary of custom headers to send, such as User-Agent, 09:38:17 If-None-Match, etc. If None, pool headers are used. If provided, 09:38:17 these headers completely replace any pool-specific headers. 09:38:17 09:38:17 :param retries: 09:38:17 Configure the number of retries to allow before raising a 09:38:17 :class:`~urllib3.exceptions.MaxRetryError` exception. 09:38:17 09:38:17 If ``None`` (default) will retry 3 times, see ``Retry.DEFAULT``. Pass a 09:38:17 :class:`~urllib3.util.retry.Retry` object for fine-grained control 09:38:17 over different types of retries. 09:38:17 Pass an integer number to retry connection errors that many times, 09:38:17 but no other types of errors. Pass zero to never retry. 09:38:17 09:38:17 If ``False``, then retries are disabled and any exception is raised 09:38:17 immediately. Also, instead of raising a MaxRetryError on redirects, 09:38:17 the redirect response will be returned. 09:38:17 09:38:17 :type retries: :class:`~urllib3.util.retry.Retry`, False, or an int. 09:38:17 09:38:17 :param redirect: 09:38:17 If True, automatically handle redirects (status codes 301, 302, 09:38:17 303, 307, 308). Each redirect counts as a retry. Disabling retries 09:38:17 will disable redirect, too. 09:38:17 09:38:17 :param assert_same_host: 09:38:17 If ``True``, will make sure that the host of the pool requests is 09:38:17 consistent else will raise HostChangedError. When ``False``, you can 09:38:17 use the pool on an HTTP proxy and request foreign hosts. 09:38:17 09:38:17 :param timeout: 09:38:17 If specified, overrides the default timeout for this one 09:38:17 request. It may be a float (in seconds) or an instance of 09:38:17 :class:`urllib3.util.Timeout`. 09:38:17 09:38:17 :param pool_timeout: 09:38:17 If set and the pool is set to block=True, then this method will 09:38:17 block for ``pool_timeout`` seconds and raise EmptyPoolError if no 09:38:17 connection is available within the time period. 09:38:17 09:38:17 :param bool preload_content: 09:38:17 If True, the response's body will be preloaded into memory. 09:38:17 09:38:17 :param bool decode_content: 09:38:17 If True, will attempt to decode the body based on the 09:38:17 'content-encoding' header. 09:38:17 09:38:17 :param release_conn: 09:38:17 If False, then the urlopen call will not release the connection 09:38:17 back into the pool once a response is received (but will release if 09:38:17 you read the entire contents of the response such as when 09:38:17 `preload_content=True`). This is useful if you're not preloading 09:38:17 the response's content immediately. You will need to call 09:38:17 ``r.release_conn()`` on the response ``r`` to return the connection 09:38:17 back into the pool. If None, it takes the value of ``preload_content`` 09:38:17 which defaults to ``True``. 09:38:17 09:38:17 :param bool chunked: 09:38:17 If True, urllib3 will send the body using chunked transfer 09:38:17 encoding. Otherwise, urllib3 will send the body using the standard 09:38:17 content-length form. Defaults to False. 09:38:17 09:38:17 :param int body_pos: 09:38:17 Position to seek to in file-like body in the event of a retry or 09:38:17 redirect. Typically this won't need to be set because urllib3 will 09:38:17 auto-populate the value when needed. 09:38:17 """ 09:38:17 parsed_url = parse_url(url) 09:38:17 destination_scheme = parsed_url.scheme 09:38:17 09:38:17 if headers is None: 09:38:17 headers = self.headers 09:38:17 09:38:17 if not isinstance(retries, Retry): 09:38:17 retries = Retry.from_int(retries, redirect=redirect, default=self.retries) 09:38:17 09:38:17 if release_conn is None: 09:38:17 release_conn = preload_content 09:38:17 09:38:17 # Check host 09:38:17 if assert_same_host and not self.is_same_host(url): 09:38:17 raise HostChangedError(self, url, retries) 09:38:17 09:38:17 # Ensure that the URL we're connecting to is properly encoded 09:38:17 if url.startswith("/"): 09:38:17 url = to_str(_encode_target(url)) 09:38:17 else: 09:38:17 url = to_str(parsed_url.url) 09:38:17 09:38:17 conn = None 09:38:17 09:38:17 # Track whether `conn` needs to be released before 09:38:17 # returning/raising/recursing. Update this variable if necessary, and 09:38:17 # leave `release_conn` constant throughout the function. That way, if 09:38:17 # the function recurses, the original value of `release_conn` will be 09:38:17 # passed down into the recursive call, and its value will be respected. 09:38:17 # 09:38:17 # See issue #651 [1] for details. 09:38:17 # 09:38:17 # [1] 09:38:17 release_this_conn = release_conn 09:38:17 09:38:17 http_tunnel_required = connection_requires_http_tunnel( 09:38:17 self.proxy, self.proxy_config, destination_scheme 09:38:17 ) 09:38:17 09:38:17 # Merge the proxy headers. Only done when not using HTTP CONNECT. We 09:38:17 # have to copy the headers dict so we can safely change it without those 09:38:17 # changes being reflected in anyone else's copy. 09:38:17 if not http_tunnel_required: 09:38:17 headers = headers.copy() # type: ignore[attr-defined] 09:38:17 headers.update(self.proxy_headers) # type: ignore[union-attr] 09:38:17 09:38:17 # Must keep the exception bound to a separate variable or else Python 3 09:38:17 # complains about UnboundLocalError. 09:38:17 err = None 09:38:17 09:38:17 # Keep track of whether we cleanly exited the except block. This 09:38:17 # ensures we do proper cleanup in finally. 09:38:17 clean_exit = False 09:38:17 09:38:17 # Rewind body position, if needed. Record current position 09:38:17 # for future rewinds in the event of a redirect/retry. 09:38:17 body_pos = set_file_position(body, body_pos) 09:38:17 09:38:17 try: 09:38:17 # Request a connection from the queue. 09:38:17 timeout_obj = self._get_timeout(timeout) 09:38:17 conn = self._get_conn(timeout=pool_timeout) 09:38:17 09:38:17 conn.timeout = timeout_obj.connect_timeout # type: ignore[assignment] 09:38:17 09:38:17 # Is this a closed/new connection that requires CONNECT tunnelling? 09:38:17 if self.proxy is not None and http_tunnel_required and conn.is_closed: 09:38:17 try: 09:38:17 self._prepare_proxy(conn) 09:38:17 except (BaseSSLError, OSError, SocketTimeout) as e: 09:38:17 self._raise_timeout( 09:38:17 err=e, url=self.proxy.url, timeout_value=conn.timeout 09:38:17 ) 09:38:17 raise 09:38:17 09:38:17 # If we're going to release the connection in ``finally:``, then 09:38:17 # the response doesn't need to know about the connection. Otherwise 09:38:17 # it will also try to release it and we'll have a double-release 09:38:17 # mess. 09:38:17 response_conn = conn if not release_conn else None 09:38:17 09:38:17 # Make the request on the HTTPConnection object 09:38:17 > response = self._make_request( 09:38:17 conn, 09:38:17 method, 09:38:17 url, 09:38:17 timeout=timeout_obj, 09:38:17 body=body, 09:38:17 headers=headers, 09:38:17 chunked=chunked, 09:38:17 retries=retries, 09:38:17 response_conn=response_conn, 09:38:17 preload_content=preload_content, 09:38:17 decode_content=decode_content, 09:38:17 **response_kw, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:789: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:495: in _make_request 09:38:17 conn.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:441: in request 09:38:17 self.endheaders() 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1289: in endheaders 09:38:17 self._send_output(message_body, encode_chunked=encode_chunked) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:1048: in _send_output 09:38:17 self.send(msg) 09:38:17 /opt/pyenv/versions/3.11.7/lib/python3.11/http/client.py:986: in send 09:38:17 self.connect() 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:279: in connect 09:38:17 self.sock = self._new_conn() 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 09:38:17 def _new_conn(self) -> socket.socket: 09:38:17 """Establish a socket connection and set nodelay settings on it. 09:38:17 09:38:17 :return: New socket connection. 09:38:17 """ 09:38:17 try: 09:38:17 sock = connection.create_connection( 09:38:17 (self._dns_host, self.port), 09:38:17 self.timeout, 09:38:17 source_address=self.source_address, 09:38:17 socket_options=self.socket_options, 09:38:17 ) 09:38:17 except socket.gaierror as e: 09:38:17 raise NameResolutionError(self.host, self, e) from e 09:38:17 except SocketTimeout as e: 09:38:17 raise ConnectTimeoutError( 09:38:17 self, 09:38:17 f"Connection to {self.host} timed out. (connect timeout={self.timeout})", 09:38:17 ) from e 09:38:17 09:38:17 except OSError as e: 09:38:17 > raise NewConnectionError( 09:38:17 self, f"Failed to establish a new connection: {e}" 09:38:17 ) from e 09:38:17 E urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno 111] Connection refused 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connection.py:214: NewConnectionError 09:38:17 09:38:17 The above exception was the direct cause of the following exception: 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 > resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:667: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/connectionpool.py:843: in urlopen 09:38:17 retries = retries.increment( 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = Retry(total=0, connect=None, read=False, redirect=None, status=None) 09:38:17 method = 'DELETE' 09:38:17 url = '/rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01' 09:38:17 response = None 09:38:17 error = NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused') 09:38:17 _pool = 09:38:17 _stacktrace = 09:38:17 09:38:17 def increment( 09:38:17 self, 09:38:17 method: str | None = None, 09:38:17 url: str | None = None, 09:38:17 response: BaseHTTPResponse | None = None, 09:38:17 error: Exception | None = None, 09:38:17 _pool: ConnectionPool | None = None, 09:38:17 _stacktrace: TracebackType | None = None, 09:38:17 ) -> Self: 09:38:17 """Return a new Retry object with incremented retry counters. 09:38:17 09:38:17 :param response: A response object, or None, if the server did not 09:38:17 return a response. 09:38:17 :type response: :class:`~urllib3.response.BaseHTTPResponse` 09:38:17 :param Exception error: An error encountered during the request, or 09:38:17 None if the response was received successfully. 09:38:17 09:38:17 :return: A new ``Retry`` object. 09:38:17 """ 09:38:17 if self.total is False and error: 09:38:17 # Disabled, indicate to re-raise the error. 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 09:38:17 total = self.total 09:38:17 if total is not None: 09:38:17 total -= 1 09:38:17 09:38:17 connect = self.connect 09:38:17 read = self.read 09:38:17 redirect = self.redirect 09:38:17 status_count = self.status 09:38:17 other = self.other 09:38:17 cause = "unknown" 09:38:17 status = None 09:38:17 redirect_location = None 09:38:17 09:38:17 if error and self._is_connection_error(error): 09:38:17 # Connect retry? 09:38:17 if connect is False: 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif connect is not None: 09:38:17 connect -= 1 09:38:17 09:38:17 elif error and self._is_read_error(error): 09:38:17 # Read retry? 09:38:17 if read is False or method is None or not self._is_method_retryable(method): 09:38:17 raise reraise(type(error), error, _stacktrace) 09:38:17 elif read is not None: 09:38:17 read -= 1 09:38:17 09:38:17 elif error: 09:38:17 # Other retry? 09:38:17 if other is not None: 09:38:17 other -= 1 09:38:17 09:38:17 elif response and response.get_redirect_location(): 09:38:17 # Redirect retry? 09:38:17 if redirect is not None: 09:38:17 redirect -= 1 09:38:17 cause = "too many redirects" 09:38:17 response_redirect_location = response.get_redirect_location() 09:38:17 if response_redirect_location: 09:38:17 redirect_location = response_redirect_location 09:38:17 status = response.status 09:38:17 09:38:17 else: 09:38:17 # Incrementing because of a server error like a 500 in 09:38:17 # status_forcelist and the given method is in the allowed_methods 09:38:17 cause = ResponseError.GENERIC_ERROR 09:38:17 if response and response.status: 09:38:17 if status_count is not None: 09:38:17 status_count -= 1 09:38:17 cause = ResponseError.SPECIFIC_ERROR.format(status_code=response.status) 09:38:17 status = response.status 09:38:17 09:38:17 history = self.history + ( 09:38:17 RequestHistory(method, url, error, status, redirect_location), 09:38:17 ) 09:38:17 09:38:17 new_retry = self.new( 09:38:17 total=total, 09:38:17 connect=connect, 09:38:17 read=read, 09:38:17 redirect=redirect, 09:38:17 status=status_count, 09:38:17 other=other, 09:38:17 history=history, 09:38:17 ) 09:38:17 09:38:17 if new_retry.is_exhausted(): 09:38:17 reason = error or ResponseError(cause) 09:38:17 > raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] 09:38:17 E urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/urllib3/util/retry.py:519: MaxRetryError 09:38:17 09:38:17 During handling of the above exception, another exception occurred: 09:38:17 09:38:17 self = 09:38:17 09:38:17 def test_40_rdmC_device_disconnected(self): 09:38:17 > response = test_utils.unmount_device("ROADMC01") 09:38:17 09:38:17 transportpce_tests/1.2.1/test05_olm.py:578: 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 transportpce_tests/common/test_utils.py:358: in unmount_device 09:38:17 response = delete_request(url[RESTCONF_VERSION].format('{}', node)) 09:38:17 transportpce_tests/common/test_utils.py:133: in delete_request 09:38:17 return requests.request( 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/api.py:59: in request 09:38:17 return session.request(method=method, url=url, **kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:589: in request 09:38:17 resp = self.send(prep, **send_kwargs) 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/sessions.py:703: in send 09:38:17 r = adapter.send(request, **kwargs) 09:38:17 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 09:38:17 09:38:17 self = 09:38:17 request = , stream = False 09:38:17 timeout = Timeout(connect=10, read=10, total=None), verify = True, cert = None 09:38:17 proxies = OrderedDict() 09:38:17 09:38:17 def send( 09:38:17 self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None 09:38:17 ): 09:38:17 """Sends PreparedRequest object. Returns Response object. 09:38:17 09:38:17 :param request: The :class:`PreparedRequest ` being sent. 09:38:17 :param stream: (optional) Whether to stream the request content. 09:38:17 :param timeout: (optional) How long to wait for the server to send 09:38:17 data before giving up, as a float, or a :ref:`(connect timeout, 09:38:17 read timeout) ` tuple. 09:38:17 :type timeout: float or tuple or urllib3 Timeout object 09:38:17 :param verify: (optional) Either a boolean, in which case it controls whether 09:38:17 we verify the server's TLS certificate, or a string, in which case it 09:38:17 must be a path to a CA bundle to use 09:38:17 :param cert: (optional) Any user-provided SSL certificate to be trusted. 09:38:17 :param proxies: (optional) The proxies dictionary to apply to the request. 09:38:17 :rtype: requests.Response 09:38:17 """ 09:38:17 09:38:17 try: 09:38:17 conn = self.get_connection_with_tls_context( 09:38:17 request, verify, proxies=proxies, cert=cert 09:38:17 ) 09:38:17 except LocationValueError as e: 09:38:17 raise InvalidURL(e, request=request) 09:38:17 09:38:17 self.cert_verify(conn, request.url, verify, cert) 09:38:17 url = self.request_url(request, proxies) 09:38:17 self.add_headers( 09:38:17 request, 09:38:17 stream=stream, 09:38:17 timeout=timeout, 09:38:17 verify=verify, 09:38:17 cert=cert, 09:38:17 proxies=proxies, 09:38:17 ) 09:38:17 09:38:17 chunked = not (request.body is None or "Content-Length" in request.headers) 09:38:17 09:38:17 if isinstance(timeout, tuple): 09:38:17 try: 09:38:17 connect, read = timeout 09:38:17 timeout = TimeoutSauce(connect=connect, read=read) 09:38:17 except ValueError: 09:38:17 raise ValueError( 09:38:17 f"Invalid timeout {timeout}. Pass a (connect, read) timeout tuple, " 09:38:17 f"or a single float to set both timeouts to the same value." 09:38:17 ) 09:38:17 elif isinstance(timeout, TimeoutSauce): 09:38:17 pass 09:38:17 else: 09:38:17 timeout = TimeoutSauce(connect=timeout, read=timeout) 09:38:17 09:38:17 try: 09:38:17 resp = conn.urlopen( 09:38:17 method=request.method, 09:38:17 url=url, 09:38:17 body=request.body, 09:38:17 headers=request.headers, 09:38:17 redirect=False, 09:38:17 assert_same_host=False, 09:38:17 preload_content=False, 09:38:17 decode_content=False, 09:38:17 retries=self.max_retries, 09:38:17 timeout=timeout, 09:38:17 chunked=chunked, 09:38:17 ) 09:38:17 09:38:17 except (ProtocolError, OSError) as err: 09:38:17 raise ConnectionError(err, request=request) 09:38:17 09:38:17 except MaxRetryError as e: 09:38:17 if isinstance(e.reason, ConnectTimeoutError): 09:38:17 # TODO: Remove this in 3.0.0: see #2811 09:38:17 if not isinstance(e.reason, NewConnectionError): 09:38:17 raise ConnectTimeout(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, ResponseError): 09:38:17 raise RetryError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _ProxyError): 09:38:17 raise ProxyError(e, request=request) 09:38:17 09:38:17 if isinstance(e.reason, _SSLError): 09:38:17 # This branch is for urllib3 v1.22 and later. 09:38:17 raise SSLError(e, request=request) 09:38:17 09:38:17 > raise ConnectionError(e, request=request) 09:38:17 E requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /rests/data/network-topology:network-topology/topology=topology-netconf/node=ROADMC01 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused')) 09:38:17 09:38:17 ../.tox/tests121/lib/python3.11/site-packages/requests/adapters.py:700: ConnectionError 09:38:17 ----------------------------- Captured stdout call ----------------------------- 09:38:17 execution of test_40_rdmC_device_disconnected 09:38:17 --------------------------- Captured stdout teardown --------------------------- 09:38:17 all processes killed 09:38:17 =========================== short test summary info ============================ 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_03_rdmA_device_connected 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_04_rdmC_device_connected 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_05_connect_xpdrA_to_roadmA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_06_connect_roadmA_to_xpdrA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_07_connect_xpdrC_to_roadmC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_08_connect_roadmC_to_xpdrC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_09_create_OTS_ROADMA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_10_create_OTS_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_11_get_PM_ROADMA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_12_get_PM_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_13_calculate_span_loss_base_ROADMA_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_14_calculate_span_loss_base_all 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_15_get_OTS_DEG1_TTP_TXRX_ROADMA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_16_get_OTS_DEG2_TTP_TXRX_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_17_servicePath_create_AToZ 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_18_servicePath_create_ZToA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_19_service_power_setup_XPDRA_XPDRC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_20_get_interface_XPDRA_XPDR1_NETWORK1 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_21_get_roadmconnection_ROADMA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_22_get_roadmconnection_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_23_service_power_setup_XPDRC_XPDRA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_24_get_interface_XPDRC_XPDR1_NETWORK1 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_25_get_roadmconnection_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_26_service_power_turndown_XPDRA_XPDRC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_27_get_roadmconnection_ROADMA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_28_get_roadmconnection_ROADMC 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_29_servicePath_delete_AToZ 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_30_servicePath_delete_ZToA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_31_connect_xpdrA_to_roadmA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_32_connect_roadmA_to_xpdrA 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_33_servicePath_create_AToZ 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_34_get_interface_XPDRA_XPDR1_NETWORK2 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_35_servicePath_delete_AToZ 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_36_xpdrA_device_disconnected 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_37_xpdrC_device_disconnected 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_38_calculate_span_loss_current 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_39_rdmA_device_disconnected 09:38:17 FAILED transportpce_tests/1.2.1/test05_olm.py::TransportOlmTesting::test_40_rdmC_device_disconnected 09:38:17 38 failed, 2 passed in 454.59s (0:07:34) 09:38:17 tests221: FAIL ✖ in 4 minutes 21.03 seconds 09:38:17 tests121: exit 1 (1870.05 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh 1.2.1 pid=35017 09:38:17 tests121: FAIL ✖ in 31 minutes 16.36 seconds 09:38:17 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 09:38:23 tests_hybrid: freeze> python -m pip freeze --all 09:38:23 tests_hybrid: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:38:23 tests_hybrid: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/tests> ./launch_tests.sh hybrid 09:38:23 using environment variables from ./karaf121.env 09:38:23 pytest -q transportpce_tests/hybrid/test01_device_change_notifications.py 09:39:08 ................................................... [100%] 09:40:54 51 passed in 150.37s (0:02:30) 09:40:54 pytest -q transportpce_tests/hybrid/test02_B100G_end2end.py 09:41:36 ........................................................................ [ 66%] 09:45:57 ..................................... [100%] 09:48:03 109 passed in 428.79s (0:07:08) 09:48:03 pytest -q transportpce_tests/hybrid/test03_autonomous_reroute.py 09:48:49 ..................................................... [100%] 09:52:21 53 passed in 258.07s (0:04:18) 09:52:21 tests_hybrid: OK ✔ in 14 minutes 4.15 seconds 09:52:21 buildlighty: install_deps> python -I -m pip install 'setuptools>=7.0' -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/requirements.txt -r /w/workspace/transportpce-tox-verify-transportpce-master/tests/test-requirements.txt 09:52:27 buildlighty: freeze> python -m pip freeze --all 09:52:28 buildlighty: bcrypt==4.2.0,certifi==2024.8.30,cffi==1.17.1,charset-normalizer==3.4.0,cryptography==43.0.1,dict2xml==1.7.6,idna==3.10,iniconfig==2.0.0,lxml==5.3.0,netconf-client==3.1.1,packaging==24.1,paramiko==3.5.0,pip==24.2,pluggy==1.5.0,psutil==6.1.0,pycparser==2.22,PyNaCl==1.5.0,pytest==8.3.3,requests==2.32.3,setuptools==75.2.0,urllib3==2.2.3,wheel==0.44.0 09:52:28 buildlighty: commands[0] /w/workspace/transportpce-tox-verify-transportpce-master/lighty> ./build.sh 09:52:28 NOTE: Picked up JDK_JAVA_OPTIONS: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED 09:52:46 [ERROR] COMPILATION ERROR : 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[17,42] cannot find symbol 09:52:46 symbol: class YangModuleInfo 09:52:46 location: package org.opendaylight.yangtools.binding 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[21,30] cannot find symbol 09:52:46 symbol: class YangModuleInfo 09:52:46 location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[343,30] cannot find symbol 09:52:46 symbol: class YangModuleInfo 09:52:46 location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[350,23] cannot find symbol 09:52:46 symbol: class YangModuleInfo 09:52:46 location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project tpce: Compilation failure: Compilation failure: 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[17,42] cannot find symbol 09:52:46 [ERROR] symbol: class YangModuleInfo 09:52:46 [ERROR] location: package org.opendaylight.yangtools.binding 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[21,30] cannot find symbol 09:52:46 [ERROR] symbol: class YangModuleInfo 09:52:46 [ERROR] location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[343,30] cannot find symbol 09:52:46 [ERROR] symbol: class YangModuleInfo 09:52:46 [ERROR] location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] /w/workspace/transportpce-tox-verify-transportpce-master/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java:[350,23] cannot find symbol 09:52:46 [ERROR] symbol: class YangModuleInfo 09:52:46 [ERROR] location: class io.lighty.controllers.tpce.utils.TPCEUtils 09:52:46 [ERROR] -> [Help 1] 09:52:46 [ERROR] 09:52:46 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 09:52:46 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 09:52:46 [ERROR] 09:52:46 [ERROR] For more information about the errors and possible solutions, please read the following articles: 09:52:46 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException 09:52:46 unzip: cannot find or open target/tpce-bin.zip, target/tpce-bin.zip.zip or target/tpce-bin.zip.ZIP. 09:52:46 buildlighty: exit 9 (18.68 seconds) /w/workspace/transportpce-tox-verify-transportpce-master/lighty> ./build.sh pid=53006 09:52:46 buildlighty: command failed but is marked ignore outcome so handling it as success 09:52:46 buildcontroller: OK (112.71=setup[7.94]+cmd[104.77] seconds) 09:52:46 testsPCE: OK (314.70=setup[79.88]+cmd[234.82] seconds) 09:52:46 sims: OK (10.73=setup[7.02]+cmd[3.72] seconds) 09:52:46 build_karaf_tests121: OK (50.98=setup[7.03]+cmd[43.94] seconds) 09:52:46 tests121: FAIL code 1 (1876.36=setup[6.31]+cmd[1870.05] seconds) 09:52:46 build_karaf_tests221: OK (53.42=setup[7.06]+cmd[46.36] seconds) 09:52:46 tests_tapi: OK (1333.45=setup[6.08]+cmd[1327.37] seconds) 09:52:46 tests221: FAIL code 1 (261.03=setup[6.21]+cmd[254.83] seconds) 09:52:46 build_karaf_tests71: OK (63.77=setup[13.95]+cmd[49.82] seconds) 09:52:46 tests71: OK (417.19=setup[5.70]+cmd[411.49] seconds) 09:52:46 build_karaf_tests_hybrid: OK (59.55=setup[7.58]+cmd[51.98] seconds) 09:52:46 tests_hybrid: OK (844.15=setup[6.23]+cmd[837.92] seconds) 09:52:46 buildlighty: OK (25.15=setup[6.47]+cmd[18.68] seconds) 09:52:46 docs: OK (31.44=setup[29.17]+cmd[2.27] seconds) 09:52:46 docs-linkcheck: OK (32.58=setup[29.19]+cmd[3.39] seconds) 09:52:46 checkbashisms: OK (2.81=setup[1.94]+cmd[0.02,0.05,0.80] seconds) 09:52:46 pre-commit: OK (43.54=setup[3.24]+cmd[0.01,0.01,32.95,7.33] seconds) 09:52:46 pylint: FAIL code 1 (27.55=setup[6.17]+cmd[21.38] seconds) 09:52:46 evaluation failed :( (3173.15 seconds) 09:52:46 + tox_status=255 09:52:46 + echo '---> Completed tox runs' 09:52:46 ---> Completed tox runs 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/build_karaf_tests121/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=build_karaf_tests121 09:52:46 + cp -r .tox/build_karaf_tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests121 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/build_karaf_tests221/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=build_karaf_tests221 09:52:46 + cp -r .tox/build_karaf_tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests221 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/build_karaf_tests71/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=build_karaf_tests71 09:52:46 + cp -r .tox/build_karaf_tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests71 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/build_karaf_tests_hybrid/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=build_karaf_tests_hybrid 09:52:46 + cp -r .tox/build_karaf_tests_hybrid/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/build_karaf_tests_hybrid 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/buildcontroller/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=buildcontroller 09:52:46 + cp -r .tox/buildcontroller/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildcontroller 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/buildlighty/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=buildlighty 09:52:46 + cp -r .tox/buildlighty/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/buildlighty 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/checkbashisms/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=checkbashisms 09:52:46 + cp -r .tox/checkbashisms/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/checkbashisms 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/docs-linkcheck/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=docs-linkcheck 09:52:46 + cp -r .tox/docs-linkcheck/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs-linkcheck 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/docs/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=docs 09:52:46 + cp -r .tox/docs/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/docs 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/pre-commit/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=pre-commit 09:52:46 + cp -r .tox/pre-commit/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pre-commit 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/pylint/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=pylint 09:52:46 + cp -r .tox/pylint/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/pylint 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/sims/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=sims 09:52:46 + cp -r .tox/sims/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/sims 09:52:46 + for i in .tox/*/log 09:52:46 ++ echo .tox/tests121/log 09:52:46 ++ awk -F/ '{print $2}' 09:52:46 + tox_env=tests121 09:52:46 + cp -r .tox/tests121/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests121 09:52:47 + for i in .tox/*/log 09:52:47 ++ echo .tox/tests221/log 09:52:47 ++ awk -F/ '{print $2}' 09:52:47 + tox_env=tests221 09:52:47 + cp -r .tox/tests221/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests221 09:52:47 + for i in .tox/*/log 09:52:47 ++ echo .tox/tests71/log 09:52:47 ++ awk -F/ '{print $2}' 09:52:47 + tox_env=tests71 09:52:47 + cp -r .tox/tests71/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests71 09:52:47 + for i in .tox/*/log 09:52:47 ++ echo .tox/testsPCE/log 09:52:47 ++ awk -F/ '{print $2}' 09:52:47 + tox_env=testsPCE 09:52:47 + cp -r .tox/testsPCE/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/testsPCE 09:52:47 + for i in .tox/*/log 09:52:47 ++ echo .tox/tests_hybrid/log 09:52:47 ++ awk -F/ '{print $2}' 09:52:47 + tox_env=tests_hybrid 09:52:47 + cp -r .tox/tests_hybrid/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_hybrid 09:52:47 + for i in .tox/*/log 09:52:47 ++ echo .tox/tests_tapi/log 09:52:47 ++ awk -F/ '{print $2}' 09:52:47 + tox_env=tests_tapi 09:52:47 + cp -r .tox/tests_tapi/log /w/workspace/transportpce-tox-verify-transportpce-master/archives/tox/tests_tapi 09:52:47 + DOC_DIR=docs/_build/html 09:52:47 + [[ -d docs/_build/html ]] 09:52:47 + echo '---> Archiving generated docs' 09:52:47 ---> Archiving generated docs 09:52:47 + mv docs/_build/html /w/workspace/transportpce-tox-verify-transportpce-master/archives/docs 09:52:47 + echo '---> tox-run.sh ends' 09:52:47 ---> tox-run.sh ends 09:52:47 + test 255 -eq 0 09:52:47 + exit 255 09:52:47 ++ '[' 1 = 1 ']' 09:52:47 ++ '[' -x /usr/bin/clear_console ']' 09:52:47 ++ /usr/bin/clear_console -q 09:52:47 Build step 'Execute shell' marked build as failure 09:52:47 $ ssh-agent -k 09:52:47 unset SSH_AUTH_SOCK; 09:52:47 unset SSH_AGENT_PID; 09:52:47 echo Agent pid 13645 killed; 09:52:47 [ssh-agent] Stopped. 09:52:47 [PostBuildScript] - [INFO] Executing post build scripts. 09:52:47 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins18390296280751998879.sh 09:52:47 ---> sysstat.sh 09:52:47 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins8057861941573067903.sh 09:52:47 ---> package-listing.sh 09:52:47 ++ tr '[:upper:]' '[:lower:]' 09:52:47 ++ facter osfamily 09:52:48 + OS_FAMILY=debian 09:52:48 + workspace=/w/workspace/transportpce-tox-verify-transportpce-master 09:52:48 + START_PACKAGES=/tmp/packages_start.txt 09:52:48 + END_PACKAGES=/tmp/packages_end.txt 09:52:48 + DIFF_PACKAGES=/tmp/packages_diff.txt 09:52:48 + PACKAGES=/tmp/packages_start.txt 09:52:48 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 09:52:48 + PACKAGES=/tmp/packages_end.txt 09:52:48 + case "${OS_FAMILY}" in 09:52:48 + grep '^ii' 09:52:48 + dpkg -l 09:52:48 + '[' -f /tmp/packages_start.txt ']' 09:52:48 + '[' -f /tmp/packages_end.txt ']' 09:52:48 + diff /tmp/packages_start.txt /tmp/packages_end.txt 09:52:48 + '[' /w/workspace/transportpce-tox-verify-transportpce-master ']' 09:52:48 + mkdir -p /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 09:52:48 + cp -f /tmp/packages_diff.txt /tmp/packages_end.txt /tmp/packages_start.txt /w/workspace/transportpce-tox-verify-transportpce-master/archives/ 09:52:48 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins1562137426775913588.sh 09:52:48 ---> capture-instance-metadata.sh 09:52:48 Setup pyenv: 09:52:48 system 09:52:48 3.8.13 09:52:48 3.9.13 09:52:48 3.10.13 09:52:48 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:52:48 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-BUI9 from file:/tmp/.os_lf_venv 09:52:49 lf-activate-venv(): INFO: Installing: lftools 09:53:00 lf-activate-venv(): INFO: Adding /tmp/venv-BUI9/bin to PATH 09:53:00 INFO: Running in OpenStack, capturing instance metadata 09:53:01 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins8097988517001912968.sh 09:53:01 provisioning config files... 09:53:01 Could not find credentials [logs] for transportpce-tox-verify-transportpce-master #2088 09:53:01 copy managed file [jenkins-log-archives-settings] to file:/w/workspace/transportpce-tox-verify-transportpce-master@tmp/config166997931072086450tmp 09:53:01 Regular expression run condition: Expression=[^.*logs-s3.*], Label=[odl-logs-s3-cloudfront-index] 09:53:01 Run condition [Regular expression match] enabling perform for step [Provide Configuration files] 09:53:01 provisioning config files... 09:53:01 copy managed file [jenkins-s3-log-ship] to file:/home/jenkins/.aws/credentials 09:53:01 [EnvInject] - Injecting environment variables from a build step. 09:53:01 [EnvInject] - Injecting as environment variables the properties content 09:53:01 SERVER_ID=logs 09:53:01 09:53:01 [EnvInject] - Variables injected successfully. 09:53:01 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins17971944179948838671.sh 09:53:01 ---> create-netrc.sh 09:53:01 WARN: Log server credential not found. 09:53:01 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins10597742998054262480.sh 09:53:01 ---> python-tools-install.sh 09:53:01 Setup pyenv: 09:53:02 system 09:53:02 3.8.13 09:53:02 3.9.13 09:53:02 3.10.13 09:53:02 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:53:02 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-BUI9 from file:/tmp/.os_lf_venv 09:53:03 lf-activate-venv(): INFO: Installing: lftools 09:53:11 lf-activate-venv(): INFO: Adding /tmp/venv-BUI9/bin to PATH 09:53:11 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins7340943491360208558.sh 09:53:11 ---> sudo-logs.sh 09:53:11 Archiving 'sudo' log.. 09:53:11 [transportpce-tox-verify-transportpce-master] $ /bin/bash /tmp/jenkins12990968173249938441.sh 09:53:11 ---> job-cost.sh 09:53:11 Setup pyenv: 09:53:11 system 09:53:11 3.8.13 09:53:11 3.9.13 09:53:11 3.10.13 09:53:11 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:53:11 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-BUI9 from file:/tmp/.os_lf_venv 09:53:12 lf-activate-venv(): INFO: Installing: zipp==1.1.0 python-openstackclient urllib3~=1.26.15 09:53:18 lf-activate-venv(): INFO: Adding /tmp/venv-BUI9/bin to PATH 09:53:18 INFO: No Stack... 09:53:18 INFO: Retrieving Pricing Info for: v3-standard-4 09:53:19 INFO: Archiving Costs 09:53:19 [transportpce-tox-verify-transportpce-master] $ /bin/bash -l /tmp/jenkins13608692630610822887.sh 09:53:19 ---> logs-deploy.sh 09:53:19 Setup pyenv: 09:53:19 system 09:53:19 3.8.13 09:53:19 3.9.13 09:53:19 3.10.13 09:53:19 * 3.11.7 (set by /w/workspace/transportpce-tox-verify-transportpce-master/.python-version) 09:53:19 lf-activate-venv(): INFO: Reuse venv:/tmp/venv-BUI9 from file:/tmp/.os_lf_venv 09:53:20 lf-activate-venv(): INFO: Installing: lftools 09:53:28 lf-activate-venv(): INFO: Adding /tmp/venv-BUI9/bin to PATH 09:53:28 WARNING: Nexus logging server not set 09:53:28 INFO: S3 path logs/releng/vex-yul-odl-jenkins-1/transportpce-tox-verify-transportpce-master/2088/ 09:53:28 INFO: archiving logs to S3 09:53:30 ---> uname -a: 09:53:30 Linux prd-ubuntu2004-docker-4c-16g-43703 5.4.0-190-generic #210-Ubuntu SMP Fri Jul 5 17:03:38 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux 09:53:30 09:53:30 09:53:30 ---> lscpu: 09:53:30 Architecture: x86_64 09:53:30 CPU op-mode(s): 32-bit, 64-bit 09:53:30 Byte Order: Little Endian 09:53:30 Address sizes: 40 bits physical, 48 bits virtual 09:53:30 CPU(s): 4 09:53:30 On-line CPU(s) list: 0-3 09:53:30 Thread(s) per core: 1 09:53:30 Core(s) per socket: 1 09:53:30 Socket(s): 4 09:53:30 NUMA node(s): 1 09:53:30 Vendor ID: AuthenticAMD 09:53:30 CPU family: 23 09:53:30 Model: 49 09:53:30 Model name: AMD EPYC-Rome Processor 09:53:30 Stepping: 0 09:53:30 CPU MHz: 2799.998 09:53:30 BogoMIPS: 5599.99 09:53:30 Virtualization: AMD-V 09:53:30 Hypervisor vendor: KVM 09:53:30 Virtualization type: full 09:53:30 L1d cache: 128 KiB 09:53:30 L1i cache: 128 KiB 09:53:30 L2 cache: 2 MiB 09:53:30 L3 cache: 64 MiB 09:53:30 NUMA node0 CPU(s): 0-3 09:53:30 Vulnerability Gather data sampling: Not affected 09:53:30 Vulnerability Itlb multihit: Not affected 09:53:30 Vulnerability L1tf: Not affected 09:53:30 Vulnerability Mds: Not affected 09:53:30 Vulnerability Meltdown: Not affected 09:53:30 Vulnerability Mmio stale data: Not affected 09:53:30 Vulnerability Retbleed: Vulnerable 09:53:30 Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp 09:53:30 Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization 09:53:30 Vulnerability Spectre v2: Mitigation; Retpolines; IBPB conditional; IBRS_FW; STIBP disabled; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected 09:53:30 Vulnerability Srbds: Not affected 09:53:30 Vulnerability Tsx async abort: Not affected 09:53:30 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 09:53:30 09:53:30 09:53:30 ---> nproc: 09:53:30 4 09:53:30 09:53:30 09:53:30 ---> df -h: 09:53:30 Filesystem Size Used Avail Use% Mounted on 09:53:30 udev 7.8G 0 7.8G 0% /dev 09:53:30 tmpfs 1.6G 1.1M 1.6G 1% /run 09:53:30 /dev/vda1 78G 16G 62G 21% / 09:53:30 tmpfs 7.9G 0 7.9G 0% /dev/shm 09:53:30 tmpfs 5.0M 0 5.0M 0% /run/lock 09:53:30 tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup 09:53:30 /dev/loop0 62M 62M 0 100% /snap/core20/1405 09:53:30 /dev/loop1 68M 68M 0 100% /snap/lxd/22753 09:53:30 /dev/loop2 44M 44M 0 100% /snap/snapd/15177 09:53:30 /dev/vda15 105M 6.1M 99M 6% /boot/efi 09:53:30 tmpfs 1.6G 0 1.6G 0% /run/user/1001 09:53:30 /dev/loop3 92M 92M 0 100% /snap/lxd/29619 09:53:30 09:53:30 09:53:30 ---> free -m: 09:53:30 total used free shared buff/cache available 09:53:30 Mem: 15997 665 7183 1 8148 14992 09:53:30 Swap: 1023 0 1023 09:53:30 09:53:30 09:53:30 ---> ip addr: 09:53:30 1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 09:53:30 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 09:53:30 inet 127.0.0.1/8 scope host lo 09:53:30 valid_lft forever preferred_lft forever 09:53:30 inet6 ::1/128 scope host 09:53:30 valid_lft forever preferred_lft forever 09:53:30 2: ens3: mtu 1458 qdisc mq state UP group default qlen 1000 09:53:30 link/ether fa:16:3e:de:7d:19 brd ff:ff:ff:ff:ff:ff 09:53:30 inet 10.30.171.17/23 brd 10.30.171.255 scope global dynamic ens3 09:53:30 valid_lft 83064sec preferred_lft 83064sec 09:53:30 inet6 fe80::f816:3eff:fede:7d19/64 scope link 09:53:30 valid_lft forever preferred_lft forever 09:53:30 3: docker0: mtu 1458 qdisc noqueue state DOWN group default 09:53:30 link/ether 02:42:bb:79:1b:6a brd ff:ff:ff:ff:ff:ff 09:53:30 inet 10.250.0.254/24 brd 10.250.0.255 scope global docker0 09:53:30 valid_lft forever preferred_lft forever 09:53:30 09:53:30 09:53:30 ---> sar -b -r -n DEV: 09:53:30 Linux 5.4.0-190-generic (prd-ubuntu2004-docker-4c-16g-43703) 10/18/24 _x86_64_ (4 CPU) 09:53:30 09:53:30 08:57:56 LINUX RESTART (4 CPU) 09:53:30 09:53:30 08:58:01 tps rtps wtps dtps bread/s bwrtn/s bdscd/s 09:53:30 08:59:02 348.34 163.76 184.59 0.00 11806.97 59519.15 0.00 09:53:30 09:00:01 125.45 28.47 96.98 0.00 1248.87 14604.73 0.00 09:53:30 09:01:01 245.83 40.49 205.33 0.00 2677.02 52050.79 0.00 09:53:30 09:02:01 52.47 1.67 50.81 0.00 89.99 21276.59 0.00 09:53:30 09:03:01 181.92 8.62 173.30 0.00 339.01 144565.11 0.00 09:53:30 09:04:01 219.56 6.72 212.85 0.00 2637.56 69755.97 0.00 09:53:30 09:05:01 73.93 2.00 71.93 0.00 75.43 6149.73 0.00 09:53:30 09:06:01 125.65 1.78 123.86 0.00 199.03 2241.36 0.00 09:53:30 09:07:01 93.60 0.08 93.52 0.00 1.33 1363.51 0.00 09:53:30 09:08:01 121.30 2.87 118.43 0.00 466.19 10101.92 0.00 09:53:30 09:09:01 2.58 0.02 2.57 0.00 0.13 61.45 0.00 09:53:30 09:10:01 1.83 0.03 1.80 0.00 0.80 25.33 0.00 09:53:30 09:11:01 2.38 0.02 2.37 0.00 0.27 36.66 0.00 09:53:30 09:12:01 86.17 0.22 85.95 0.00 17.73 1544.01 0.00 09:53:30 09:13:01 17.70 1.00 16.70 0.00 22.80 384.47 0.00 09:53:30 09:14:01 87.04 0.20 86.84 0.00 4.40 1386.97 0.00 09:53:30 09:15:01 2.77 0.00 2.77 0.00 0.00 70.39 0.00 09:53:30 09:16:01 79.29 0.00 79.29 0.00 0.00 1354.71 0.00 09:53:30 09:17:01 3.38 0.03 3.35 0.00 0.93 74.39 0.00 09:53:30 09:18:01 49.93 0.03 49.89 0.00 0.27 798.53 0.00 09:53:30 09:19:01 56.63 0.00 56.63 0.00 0.00 829.47 0.00 09:53:30 09:20:01 3.10 0.00 3.10 0.00 0.00 59.32 0.00 09:53:30 09:21:01 3.30 0.00 3.30 0.00 0.00 62.26 0.00 09:53:30 09:22:01 3.35 0.00 3.35 0.00 0.00 65.32 0.00 09:53:30 09:23:01 2.03 0.00 2.03 0.00 0.00 31.73 0.00 09:53:30 09:24:01 2.30 0.00 2.30 0.00 0.00 31.32 0.00 09:53:30 09:25:01 12.26 0.00 12.26 0.00 0.00 794.67 0.00 09:53:30 09:26:01 128.41 0.03 128.38 0.00 0.27 9731.44 0.00 09:53:30 09:27:01 122.31 0.00 122.31 0.00 0.00 1776.24 0.00 09:53:30 09:28:01 2.43 0.00 2.43 0.00 0.00 45.99 0.00 09:53:30 09:29:01 77.62 0.00 77.62 0.00 0.00 1127.01 0.00 09:53:30 09:30:01 1.68 0.00 1.68 0.00 0.00 36.79 0.00 09:53:30 09:31:01 99.80 0.00 99.80 0.00 0.00 1692.37 0.00 09:53:30 09:32:01 21.15 0.05 21.10 0.00 0.53 662.82 0.00 09:53:30 09:33:01 77.44 0.00 77.44 0.00 0.00 3094.44 0.00 09:53:30 09:34:01 93.70 0.00 93.70 0.00 0.00 1381.77 0.00 09:53:30 09:35:01 71.19 0.00 71.19 0.00 0.00 1133.54 0.00 09:53:30 09:36:01 2.80 0.00 2.80 0.00 0.00 49.99 0.00 09:53:30 09:37:01 2.87 0.00 2.87 0.00 0.00 40.93 0.00 09:53:30 09:38:01 1.50 0.05 1.45 0.00 1.87 19.47 0.00 09:53:30 09:39:01 58.21 0.03 58.17 0.00 0.27 4499.12 0.00 09:53:30 09:40:01 60.54 0.00 60.54 0.00 0.00 5735.71 0.00 09:53:30 09:41:01 15.96 0.00 15.96 0.00 0.00 375.61 0.00 09:53:30 09:42:01 69.19 0.00 69.19 0.00 0.00 1095.28 0.00 09:53:30 09:43:02 2.52 0.00 2.52 0.00 0.00 57.86 0.00 09:53:30 09:44:01 2.69 0.00 2.69 0.00 0.00 45.28 0.00 09:53:30 09:45:01 2.28 0.00 2.28 0.00 0.00 40.53 0.00 09:53:30 09:46:01 1.72 0.00 1.72 0.00 0.00 31.87 0.00 09:53:30 09:47:01 1.97 0.00 1.97 0.00 0.00 48.93 0.00 09:53:30 09:48:01 1.97 0.00 1.97 0.00 0.00 42.79 0.00 09:53:30 09:49:01 84.64 0.00 84.64 0.00 0.00 1227.06 0.00 09:53:30 09:50:01 2.68 0.00 2.68 0.00 0.00 161.47 0.00 09:53:30 09:51:01 2.35 0.00 2.35 0.00 0.00 58.66 0.00 09:53:30 09:52:01 2.03 0.00 2.03 0.00 0.00 63.99 0.00 09:53:30 09:53:01 39.43 11.91 27.51 0.00 449.39 3029.50 0.00 09:53:30 Average: 55.54 4.90 50.64 0.00 364.22 7755.61 0.00 09:53:30 09:53:30 08:58:01 kbmemfree kbavail kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 09:53:30 08:59:02 13570232 15419308 572120 3.49 53684 2003244 1296836 7.44 784304 1772540 90824 09:53:30 09:00:01 12841932 15323192 638372 3.90 91028 2557916 1492604 8.56 950096 2264208 366920 09:53:30 09:01:01 10534740 14363912 1595244 9.74 138348 3756544 2292272 13.15 2076008 3340360 155184 09:53:30 09:02:01 8856712 14340884 1616932 9.87 163620 5309776 2478160 14.22 2428584 4587804 1162480 09:53:30 09:03:01 5848092 14280448 1674744 10.22 208280 8085944 2603160 14.94 3478100 6414316 881948 09:53:30 09:04:01 4697892 13974388 1972644 12.04 225340 8883340 2718420 15.60 4135096 6866276 145940 09:53:30 09:05:01 168604 8855372 7089004 43.27 219264 8312068 8203712 47.07 9131632 6390452 216 09:53:30 09:06:01 155684 8660104 7283472 44.46 225084 8125704 8592560 49.30 9339608 6196672 472 09:53:30 09:07:01 1074900 9501200 6442424 39.33 228564 8043632 7421140 42.58 8498312 6120744 14412 09:53:30 09:08:01 182612 7403412 8539120 52.13 236680 6848116 9668772 55.47 10495928 5022700 1260 09:53:30 09:09:01 183032 7403888 8538664 52.12 236696 6848116 9668772 55.47 10496008 5022476 144 09:53:30 09:10:01 180116 7401044 8541480 52.14 236720 6848168 9668772 55.47 10499384 5022488 356 09:53:30 09:11:01 164624 7330700 8611788 52.57 236744 6793656 9720172 55.77 10563172 4973560 156 09:53:30 09:12:01 171172 7324280 8618236 52.61 239456 6778232 9737772 55.87 10590664 4940784 428 09:53:30 09:13:01 5401024 12555140 3389508 20.69 239572 6778796 4463760 25.61 5390632 4931576 496 09:53:30 09:14:01 2655696 9812620 6131224 37.43 241532 6779552 7345444 42.14 8130376 4929324 540 09:53:30 09:15:01 2212452 9369968 6573524 40.13 241572 6780088 7559820 43.37 8570508 4929296 76 09:53:30 09:16:01 1203968 8364208 7578516 46.26 243524 6780804 8810816 50.55 9587224 4916856 596 09:53:30 09:17:01 1174572 8335240 7607392 46.44 243556 6781172 8842840 50.73 9615628 4917240 372 09:53:30 09:18:01 3554360 10716300 5227188 31.91 244084 6781864 7066376 40.54 7252360 4908372 592 09:53:30 09:19:01 1042640 8206680 7735768 47.22 245508 6782488 8904540 51.09 9755680 4908936 132 09:53:30 09:20:01 806940 7971212 7971196 48.66 245524 6782712 8978192 51.51 9990716 4908816 224 09:53:30 09:21:01 787900 7952476 7989936 48.77 245548 6782988 8978192 51.51 10010512 4909084 160 09:53:30 09:22:01 755172 7920064 8022288 48.97 245588 6783268 9010168 51.69 10042364 4909364 216 09:53:30 09:23:01 568060 7732996 8209352 50.11 245600 6783292 9043912 51.89 10227516 4909388 164 09:53:30 09:24:01 562140 7727108 8215244 50.15 245624 6783296 9043912 51.89 10232348 4909388 236 09:53:30 09:25:01 4245760 11489336 4453568 27.19 248264 6855156 5361640 30.76 6495808 4972884 60784 09:53:30 09:26:01 2804352 10210228 5732568 34.99 253248 7009976 6561400 37.64 7845952 5057912 676 09:53:30 09:27:01 4192080 11600192 4343904 26.52 255100 7010280 5236732 30.04 6465504 5054556 352 09:53:30 09:28:01 4179816 11588092 4356004 26.59 255116 7010428 5252732 30.14 6478632 5054672 200 09:53:30 09:29:01 3541044 10951248 4992560 30.48 256680 7010636 5929144 34.02 7125732 5043464 252 09:53:30 09:30:01 3371084 10781532 5162196 31.51 256700 7010860 5962144 34.21 7294420 5043428 300 09:53:30 09:31:01 5421068 12832440 3112348 19.00 257432 7011092 4515448 25.91 5254012 5042796 804 09:53:30 09:32:01 4550208 12028352 3915560 23.90 259620 7071576 5347828 30.68 6059624 5100880 62664 09:53:30 09:33:01 1886404 9365496 6577344 40.15 260364 7071872 8071268 46.31 8714852 5101168 136 09:53:30 09:34:01 4534868 12014896 3928756 23.98 261012 7072144 5393816 30.95 6089344 5087732 456 09:53:30 09:35:01 1334916 8816392 7126064 43.50 261692 7072848 8676648 49.78 9278280 5087604 148 09:53:30 09:36:01 1045768 8527468 7414944 45.26 261700 7073064 8759976 50.26 9566184 5087816 204 09:53:30 09:37:01 4848048 12329540 3613888 22.06 261704 7072852 4959100 28.45 5776936 5086832 220 09:53:30 09:38:01 4834360 12315908 3627524 22.14 261704 7072912 4959100 28.45 5790668 5086704 72 09:53:30 09:39:01 4550632 12273084 3671620 22.41 268016 7300308 5034072 28.88 5892656 5263416 142668 09:53:30 09:40:01 3630860 11355796 4588292 28.01 268400 7302140 5342412 30.65 6812532 5257484 60 09:53:30 09:41:01 7225588 14951032 994784 6.07 268428 7302476 1820668 10.45 3245736 5245640 732 09:53:30 09:42:01 3846420 11572664 4371224 26.68 268820 7302892 5157192 29.59 6619824 5236252 492 09:53:30 09:43:02 3849124 11575536 4368352 26.67 268828 7303052 5157192 29.59 6617328 5236264 100 09:53:30 09:44:01 3828640 11555248 4388756 26.79 268832 7303244 5157192 29.59 6636436 5236444 0 09:53:30 09:45:01 3816208 11543000 4401064 26.87 268836 7303424 5173260 29.68 6649936 5236624 96 09:53:30 09:46:01 3800544 11527540 4416496 26.96 268836 7303632 5173260 29.68 6665160 5236828 220 09:53:30 09:47:01 3776580 11504040 4439892 27.10 268836 7304100 5173260 29.68 6687508 5237272 104 09:53:30 09:48:01 3785556 11513356 4430564 27.05 268840 7304428 5173072 29.68 6678600 5237588 188 09:53:30 09:49:01 3112648 10840464 5103444 31.15 269240 7304056 5912288 33.92 7362752 5225824 344 09:53:30 09:50:01 3025444 10753752 5189932 31.68 269240 7304540 6020828 34.54 7449924 5226156 156 09:53:30 09:51:01 2890212 10619664 5323928 32.50 269244 7305692 6085604 34.91 7582632 5227236 776 09:53:30 09:52:01 2853672 10583784 5359756 32.72 269244 7306340 6085604 34.91 7618476 5227880 536 09:53:30 09:53:01 7477400 15437428 508648 3.11 274664 7516356 1228628 7.05 2821492 5403852 140372 09:53:30 Average: 3483901 10740066 5205443 31.78 242098 6886675 6223502 35.71 7197267 5046659 58885 09:53:30 09:53:30 08:58:01 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil 09:53:30 08:59:02 lo 1.63 1.63 0.16 0.16 0.00 0.00 0.00 0.00 09:53:30 08:59:02 ens3 404.43 273.64 1580.56 72.32 0.00 0.00 0.00 0.00 09:53:30 08:59:02 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:00:01 lo 2.17 2.17 0.20 0.20 0.00 0.00 0.00 0.00 09:53:30 09:00:01 ens3 115.78 94.75 1610.45 14.02 0.00 0.00 0.00 0.00 09:53:30 09:00:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:01:01 lo 4.67 4.67 0.49 0.49 0.00 0.00 0.00 0.00 09:53:30 09:01:01 ens3 440.79 358.89 6727.88 36.68 0.00 0.00 0.00 0.00 09:53:30 09:01:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:02:01 lo 1.07 1.07 0.10 0.10 0.00 0.00 0.00 0.00 09:53:30 09:02:01 ens3 412.68 304.65 5640.23 29.19 0.00 0.00 0.00 0.00 09:53:30 09:02:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:03:01 lo 1.07 1.07 0.11 0.11 0.00 0.00 0.00 0.00 09:53:30 09:03:01 ens3 68.09 35.04 1781.08 5.84 0.00 0.00 0.00 0.00 09:53:30 09:03:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:04:01 lo 4.35 4.35 0.65 0.65 0.00 0.00 0.00 0.00 09:53:30 09:04:01 ens3 73.57 26.31 1393.31 2.31 0.00 0.00 0.00 0.00 09:53:30 09:04:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:05:01 lo 26.82 26.82 29.52 29.52 0.00 0.00 0.00 0.00 09:53:30 09:05:01 ens3 1.55 1.82 0.26 0.28 0.00 0.00 0.00 0.00 09:53:30 09:05:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:06:01 lo 33.23 33.23 25.71 25.71 0.00 0.00 0.00 0.00 09:53:30 09:06:01 ens3 1.43 1.72 0.25 0.26 0.00 0.00 0.00 0.00 09:53:30 09:06:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:07:01 lo 34.31 34.31 16.80 16.80 0.00 0.00 0.00 0.00 09:53:30 09:07:01 ens3 0.92 1.07 0.16 0.17 0.00 0.00 0.00 0.00 09:53:30 09:07:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:08:01 lo 9.82 9.82 8.47 8.47 0.00 0.00 0.00 0.00 09:53:30 09:08:01 ens3 1.65 1.88 0.75 0.66 0.00 0.00 0.00 0.00 09:53:30 09:08:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:09:01 lo 0.75 0.75 0.08 0.08 0.00 0.00 0.00 0.00 09:53:30 09:09:01 ens3 0.35 0.20 0.14 0.07 0.00 0.00 0.00 0.00 09:53:30 09:09:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:10:01 lo 2.08 2.08 0.22 0.22 0.00 0.00 0.00 0.00 09:53:30 09:10:01 ens3 0.28 0.22 0.04 0.03 0.00 0.00 0.00 0.00 09:53:30 09:10:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:11:01 lo 2.90 2.90 1.94 1.94 0.00 0.00 0.00 0.00 09:53:30 09:11:01 ens3 0.32 0.27 0.06 0.05 0.00 0.00 0.00 0.00 09:53:30 09:11:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:12:01 lo 9.58 9.58 3.09 3.09 0.00 0.00 0.00 0.00 09:53:30 09:12:01 ens3 0.98 0.85 0.16 0.15 0.00 0.00 0.00 0.00 09:53:30 09:12:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:13:01 lo 1.20 1.20 0.10 0.10 0.00 0.00 0.00 0.00 09:53:30 09:13:01 ens3 0.68 0.18 0.08 0.03 0.00 0.00 0.00 0.00 09:53:30 09:13:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:14:01 lo 7.28 7.28 10.82 10.82 0.00 0.00 0.00 0.00 09:53:30 09:14:01 ens3 1.83 1.18 0.80 0.56 0.00 0.00 0.00 0.00 09:53:30 09:14:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:15:01 lo 34.89 34.89 15.89 15.89 0.00 0.00 0.00 0.00 09:53:30 09:15:01 ens3 0.78 0.87 0.13 0.14 0.00 0.00 0.00 0.00 09:53:30 09:15:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:16:01 lo 18.73 18.73 9.34 9.34 0.00 0.00 0.00 0.00 09:53:30 09:16:01 ens3 0.97 1.05 0.14 0.15 0.00 0.00 0.00 0.00 09:53:30 09:16:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:17:01 lo 31.04 31.04 11.04 11.04 0.00 0.00 0.00 0.00 09:53:30 09:17:01 ens3 0.28 0.17 0.03 0.02 0.00 0.00 0.00 0.00 09:53:30 09:17:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:18:01 lo 4.75 4.75 0.49 0.49 0.00 0.00 0.00 0.00 09:53:30 09:18:01 ens3 0.82 0.83 0.11 0.11 0.00 0.00 0.00 0.00 09:53:30 09:18:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:19:01 lo 35.73 35.73 15.19 15.19 0.00 0.00 0.00 0.00 09:53:30 09:19:01 ens3 0.93 0.87 0.27 0.20 0.00 0.00 0.00 0.00 09:53:30 09:19:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:20:01 lo 14.98 14.98 8.28 8.28 0.00 0.00 0.00 0.00 09:53:30 09:20:01 ens3 1.22 1.07 0.23 0.22 0.00 0.00 0.00 0.00 09:53:30 09:20:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:21:01 lo 12.00 12.00 8.11 8.11 0.00 0.00 0.00 0.00 09:53:30 09:21:01 ens3 0.98 0.87 0.20 0.18 0.00 0.00 0.00 0.00 09:53:30 09:21:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:22:01 lo 26.11 26.11 8.91 8.91 0.00 0.00 0.00 0.00 09:53:30 09:22:01 ens3 0.67 0.48 0.11 0.09 0.00 0.00 0.00 0.00 09:53:30 09:22:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:23:01 lo 6.72 6.72 4.26 4.26 0.00 0.00 0.00 0.00 09:53:30 09:23:01 ens3 0.45 0.30 0.07 0.06 0.00 0.00 0.00 0.00 09:53:30 09:23:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:24:01 lo 0.90 0.90 0.09 0.09 0.00 0.00 0.00 0.00 09:53:30 09:24:01 ens3 0.47 0.27 0.16 0.08 0.00 0.00 0.00 0.00 09:53:30 09:24:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:25:01 lo 2.17 2.17 0.44 0.44 0.00 0.00 0.00 0.00 09:53:30 09:25:01 ens3 1.53 1.95 0.76 0.70 0.00 0.00 0.00 0.00 09:53:30 09:25:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:26:01 lo 19.73 19.73 19.83 19.83 0.00 0.00 0.00 0.00 09:53:30 09:26:01 ens3 1.38 1.75 0.26 0.28 0.00 0.00 0.00 0.00 09:53:30 09:26:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:27:01 lo 34.34 34.34 14.95 14.95 0.00 0.00 0.00 0.00 09:53:30 09:27:01 ens3 1.65 2.18 0.32 0.35 0.00 0.00 0.00 0.00 09:53:30 09:27:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:28:01 lo 27.70 27.70 9.19 9.19 0.00 0.00 0.00 0.00 09:53:30 09:28:01 ens3 1.22 1.57 0.25 0.25 0.00 0.00 0.00 0.00 09:53:30 09:28:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:29:01 lo 17.36 17.36 11.04 11.04 0.00 0.00 0.00 0.00 09:53:30 09:29:01 ens3 1.07 1.25 0.28 0.23 0.00 0.00 0.00 0.00 09:53:30 09:29:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:30:01 lo 37.76 37.76 13.41 13.41 0.00 0.00 0.00 0.00 09:53:30 09:30:01 ens3 1.35 1.70 0.26 0.27 0.00 0.00 0.00 0.00 09:53:30 09:30:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:31:01 lo 29.59 29.59 10.77 10.77 0.00 0.00 0.00 0.00 09:53:30 09:31:01 ens3 1.82 2.20 0.33 0.34 0.00 0.00 0.00 0.00 09:53:30 09:31:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:32:01 lo 28.86 28.86 13.78 13.78 0.00 0.00 0.00 0.00 09:53:30 09:32:01 ens3 3.23 3.37 1.24 1.06 0.00 0.00 0.00 0.00 09:53:30 09:32:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:33:01 lo 13.98 13.98 9.94 9.94 0.00 0.00 0.00 0.00 09:53:30 09:33:01 ens3 1.62 1.55 0.54 0.46 0.00 0.00 0.00 0.00 09:53:30 09:33:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:34:01 lo 15.26 15.26 4.87 4.87 0.00 0.00 0.00 0.00 09:53:30 09:34:01 ens3 1.30 1.23 0.33 0.26 0.00 0.00 0.00 0.00 09:53:30 09:34:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:35:01 lo 13.08 13.08 9.93 9.93 0.00 0.00 0.00 0.00 09:53:30 09:35:01 ens3 0.95 1.00 0.14 0.14 0.00 0.00 0.00 0.00 09:53:30 09:35:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:36:01 lo 21.11 21.11 9.70 9.70 0.00 0.00 0.00 0.00 09:53:30 09:36:01 ens3 0.98 1.42 0.22 0.23 0.00 0.00 0.00 0.00 09:53:30 09:36:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:37:01 lo 1.13 1.13 0.24 0.24 0.00 0.00 0.00 0.00 09:53:30 09:37:01 ens3 0.82 0.80 0.13 0.28 0.00 0.00 0.00 0.00 09:53:30 09:37:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:38:01 lo 0.90 0.90 0.04 0.04 0.00 0.00 0.00 0.00 09:53:30 09:38:01 ens3 1.08 1.43 0.22 0.23 0.00 0.00 0.00 0.00 09:53:30 09:38:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:39:01 lo 2.27 2.27 0.19 0.19 0.00 0.00 0.00 0.00 09:53:30 09:39:01 ens3 38.74 33.86 9.15 26.01 0.00 0.00 0.00 0.00 09:53:30 09:39:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:40:01 lo 43.53 43.53 37.33 37.33 0.00 0.00 0.00 0.00 09:53:30 09:40:01 ens3 1.18 1.43 0.47 0.41 0.00 0.00 0.00 0.00 09:53:30 09:40:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:41:01 lo 28.59 28.59 10.31 10.31 0.00 0.00 0.00 0.00 09:53:30 09:41:01 ens3 1.62 1.37 0.26 0.21 0.00 0.00 0.00 0.00 09:53:30 09:41:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:42:01 lo 33.69 33.69 17.49 17.49 0.00 0.00 0.00 0.00 09:53:30 09:42:01 ens3 1.15 0.97 0.42 0.35 0.00 0.00 0.00 0.00 09:53:30 09:42:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:43:02 lo 10.88 10.88 4.54 4.54 0.00 0.00 0.00 0.00 09:53:30 09:43:02 ens3 1.50 0.70 0.23 0.13 0.00 0.00 0.00 0.00 09:53:30 09:43:02 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:44:01 lo 17.83 17.83 7.36 7.36 0.00 0.00 0.00 0.00 09:53:30 09:44:01 ens3 0.90 0.71 0.27 0.19 0.00 0.00 0.00 0.00 09:53:30 09:44:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:45:01 lo 16.36 16.36 6.47 6.47 0.00 0.00 0.00 0.00 09:53:30 09:45:01 ens3 0.60 0.50 0.10 0.09 0.00 0.00 0.00 0.00 09:53:30 09:45:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:46:01 lo 30.37 30.37 10.57 10.57 0.00 0.00 0.00 0.00 09:53:30 09:46:01 ens3 0.78 0.65 0.14 0.14 0.00 0.00 0.00 0.00 09:53:30 09:46:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:47:01 lo 28.75 28.75 10.33 10.33 0.00 0.00 0.00 0.00 09:53:30 09:47:01 ens3 0.67 0.48 0.11 0.09 0.00 0.00 0.00 0.00 09:53:30 09:47:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:48:01 lo 36.93 36.93 12.11 12.11 0.00 0.00 0.00 0.00 09:53:30 09:48:01 ens3 1.02 0.83 0.19 0.17 0.00 0.00 0.00 0.00 09:53:30 09:48:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:49:01 lo 21.64 21.64 13.69 13.69 0.00 0.00 0.00 0.00 09:53:30 09:49:01 ens3 1.05 0.90 0.25 0.18 0.00 0.00 0.00 0.00 09:53:30 09:49:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:50:01 lo 31.10 31.10 10.29 10.29 0.00 0.00 0.00 0.00 09:53:30 09:50:01 ens3 0.87 0.75 0.17 0.16 0.00 0.00 0.00 0.00 09:53:30 09:50:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:51:01 lo 88.77 88.77 32.01 32.01 0.00 0.00 0.00 0.00 09:53:30 09:51:01 ens3 0.50 0.40 0.08 0.08 0.00 0.00 0.00 0.00 09:53:30 09:51:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:52:01 lo 72.44 72.44 23.76 23.76 0.00 0.00 0.00 0.00 09:53:30 09:52:01 ens3 0.55 0.40 0.09 0.08 0.00 0.00 0.00 0.00 09:53:30 09:52:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:53:01 lo 3.20 3.20 1.08 1.08 0.00 0.00 0.00 0.00 09:53:30 09:53:01 ens3 160.07 125.21 1955.25 23.30 0.00 0.00 0.00 0.00 09:53:30 09:53:01 docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 Average: lo 19.24 19.24 9.20 9.20 0.00 0.00 0.00 0.00 09:53:30 Average: ens3 32.06 23.66 376.28 4.01 0.00 0.00 0.00 0.00 09:53:30 Average: docker0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 09:53:30 09:53:30 09:53:30 ---> sar -P ALL: 09:53:30 Linux 5.4.0-190-generic (prd-ubuntu2004-docker-4c-16g-43703) 10/18/24 _x86_64_ (4 CPU) 09:53:30 09:53:30 08:57:56 LINUX RESTART (4 CPU) 09:53:30 09:53:30 08:58:01 CPU %user %nice %system %iowait %steal %idle 09:53:30 08:59:02 all 15.35 18.17 14.23 4.65 0.14 47.46 09:53:30 08:59:02 0 10.46 19.41 14.31 4.68 0.17 50.97 09:53:30 08:59:02 1 22.79 16.45 12.98 3.52 0.13 44.12 09:53:30 08:59:02 2 15.28 17.93 15.55 3.32 0.15 47.77 09:53:30 08:59:02 3 12.82 18.91 14.08 7.09 0.10 47.00 09:53:30 09:00:01 all 24.04 2.88 4.52 3.51 0.07 64.98 09:53:30 09:00:01 0 13.66 3.04 4.20 4.78 0.05 74.27 09:53:30 09:00:01 1 12.91 3.59 4.47 6.00 0.10 72.93 09:53:30 09:00:01 2 31.04 2.54 4.69 1.31 0.05 60.37 09:53:30 09:00:01 3 38.58 2.36 4.71 1.95 0.07 52.33 09:53:30 09:01:01 all 76.65 0.00 3.65 5.23 0.12 14.34 09:53:30 09:01:01 0 70.05 0.00 3.62 5.05 0.13 21.14 09:53:30 09:01:01 1 79.35 0.00 3.07 2.21 0.10 15.27 09:53:30 09:01:01 2 82.91 0.00 3.63 1.69 0.12 11.65 09:53:30 09:01:01 3 74.27 0.00 4.29 11.98 0.13 9.33 09:53:30 09:02:01 all 52.76 0.00 2.79 1.64 0.12 42.70 09:53:30 09:02:01 0 46.17 0.00 2.09 3.20 0.13 48.41 09:53:30 09:02:01 1 35.97 0.00 2.07 1.30 0.12 60.55 09:53:30 09:02:01 2 65.44 0.00 4.32 0.55 0.12 29.56 09:53:30 09:02:01 3 63.56 0.00 2.67 1.53 0.10 32.15 09:53:30 09:03:01 all 78.22 0.00 4.13 11.40 0.13 6.13 09:53:30 09:03:01 0 82.19 0.00 4.04 12.62 0.10 1.06 09:53:30 09:03:01 1 75.71 0.00 4.38 18.10 0.12 1.69 09:53:30 09:03:01 2 73.97 0.00 3.94 8.51 0.17 13.41 09:53:30 09:03:01 3 81.05 0.00 4.15 6.32 0.12 8.36 09:53:30 09:04:01 all 83.38 0.00 3.77 6.55 0.15 6.16 09:53:30 09:04:01 0 82.37 0.00 3.92 10.18 0.15 3.38 09:53:30 09:04:01 1 81.94 0.00 3.16 2.41 0.15 12.34 09:53:30 09:04:01 2 87.75 0.00 3.87 4.75 0.13 3.50 09:53:30 09:04:01 3 81.43 0.00 4.12 8.84 0.15 5.46 09:53:30 09:05:01 all 58.84 0.00 1.88 0.45 0.12 38.72 09:53:30 09:05:01 0 58.50 0.00 2.13 0.00 0.10 39.27 09:53:30 09:05:01 1 57.28 0.00 2.17 1.78 0.12 38.65 09:53:30 09:05:01 2 62.95 0.00 1.24 0.02 0.12 35.67 09:53:30 09:05:01 3 56.63 0.00 1.97 0.00 0.13 41.26 09:53:30 09:06:01 all 48.84 0.00 1.69 0.24 0.11 49.12 09:53:30 09:06:01 0 47.49 0.00 1.69 0.15 0.12 50.55 09:53:30 09:06:01 1 47.94 0.00 1.73 0.40 0.10 49.83 09:53:30 09:06:01 2 49.79 0.00 1.67 0.37 0.12 48.05 09:53:30 09:06:01 3 50.13 0.00 1.67 0.03 0.10 48.06 09:53:30 09:07:01 all 25.83 0.00 1.08 0.41 0.10 72.58 09:53:30 09:07:01 0 22.50 0.00 0.98 0.86 0.10 75.57 09:53:30 09:07:01 1 26.07 0.00 1.05 0.25 0.10 72.52 09:53:30 09:07:01 2 27.52 0.00 1.23 0.42 0.12 70.72 09:53:30 09:07:01 3 27.20 0.00 1.07 0.13 0.08 71.51 09:53:30 09:08:01 all 38.57 0.00 1.65 1.52 0.10 58.16 09:53:30 09:08:01 0 36.50 0.00 1.48 1.16 0.10 60.76 09:53:30 09:08:01 1 38.99 0.00 1.72 4.06 0.10 55.14 09:53:30 09:08:01 2 41.51 0.00 1.29 0.12 0.10 56.98 09:53:30 09:08:01 3 37.25 0.00 2.12 0.76 0.12 59.76 09:53:30 09:09:01 all 0.92 0.00 0.30 0.02 0.08 98.69 09:53:30 09:09:01 0 0.88 0.00 0.30 0.00 0.08 98.74 09:53:30 09:09:01 1 0.72 0.00 0.30 0.03 0.08 98.86 09:53:30 09:09:01 2 1.06 0.00 0.37 0.05 0.08 98.44 09:53:30 09:09:01 3 1.00 0.00 0.22 0.00 0.07 98.71 09:53:30 09:53:30 09:09:01 CPU %user %nice %system %iowait %steal %idle 09:53:30 09:10:01 all 1.21 0.00 0.23 0.01 0.07 98.47 09:53:30 09:10:01 0 1.26 0.00 0.27 0.00 0.07 98.41 09:53:30 09:10:01 1 1.19 0.00 0.20 0.00 0.07 98.54 09:53:30 09:10:01 2 1.53 0.00 0.30 0.03 0.08 98.06 09:53:30 09:10:01 3 0.87 0.00 0.17 0.00 0.07 98.89 09:53:30 09:11:01 all 2.02 0.00 0.27 0.01 0.08 97.62 09:53:30 09:11:01 0 2.11 0.00 0.25 0.00 0.08 97.55 09:53:30 09:11:01 1 2.36 0.00 0.27 0.00 0.08 97.29 09:53:30 09:11:01 2 1.70 0.00 0.25 0.05 0.07 97.94 09:53:30 09:11:01 3 1.93 0.00 0.30 0.00 0.07 97.70 09:53:30 09:12:01 all 32.05 0.00 1.27 0.35 0.09 66.24 09:53:30 09:12:01 0 32.52 0.00 1.39 1.27 0.08 64.74 09:53:30 09:12:01 1 28.72 0.00 1.09 0.03 0.08 70.08 09:53:30 09:12:01 2 33.23 0.00 1.07 0.07 0.10 65.53 09:53:30 09:12:01 3 33.71 0.00 1.54 0.03 0.10 64.62 09:53:30 09:13:01 all 16.82 0.00 0.95 0.03 0.10 82.10 09:53:30 09:13:01 0 17.15 0.00 0.82 0.03 0.10 81.90 09:53:30 09:13:01 1 18.53 0.00 1.09 0.05 0.10 80.23 09:53:30 09:13:01 2 17.68 0.00 0.72 0.00 0.12 81.48 09:53:30 09:13:01 3 13.89 0.00 1.18 0.03 0.08 84.81 09:53:30 09:14:01 all 54.10 0.00 2.03 0.26 0.11 43.50 09:53:30 09:14:01 0 54.89 0.00 2.49 0.57 0.10 41.94 09:53:30 09:14:01 1 52.92 0.00 1.57 0.03 0.12 45.36 09:53:30 09:14:01 2 56.59 0.00 1.82 0.25 0.10 41.24 09:53:30 09:14:01 3 52.00 0.00 2.24 0.20 0.12 45.45 09:53:30 09:15:01 all 12.84 0.00 0.62 0.01 0.10 86.42 09:53:30 09:15:01 0 12.40 0.00 0.63 0.02 0.12 86.83 09:53:30 09:15:01 1 12.95 0.00 0.72 0.03 0.12 86.18 09:53:30 09:15:01 2 12.29 0.00 0.58 0.00 0.08 87.04 09:53:30 09:15:01 3 13.70 0.00 0.56 0.00 0.10 85.64 09:53:30 09:16:01 all 45.31 0.00 1.52 0.32 0.11 52.74 09:53:30 09:16:01 0 45.37 0.00 2.01 0.74 0.12 51.76 09:53:30 09:16:01 1 45.55 0.00 1.22 0.05 0.10 53.08 09:53:30 09:16:01 2 43.81 0.00 1.42 0.42 0.12 54.24 09:53:30 09:16:01 3 46.52 0.00 1.42 0.08 0.10 51.87 09:53:30 09:17:01 all 4.43 0.00 0.43 0.02 0.08 95.03 09:53:30 09:17:01 0 4.60 0.00 0.43 0.08 0.07 94.81 09:53:30 09:17:01 1 4.38 0.00 0.37 0.00 0.08 95.17 09:53:30 09:17:01 2 3.82 0.00 0.42 0.00 0.08 95.68 09:53:30 09:17:01 3 4.94 0.00 0.50 0.00 0.08 94.47 09:53:30 09:18:01 all 47.85 0.00 1.74 0.05 0.11 50.24 09:53:30 09:18:01 0 49.99 0.00 1.68 0.05 0.12 48.16 09:53:30 09:18:01 1 46.94 0.00 1.37 0.03 0.10 51.56 09:53:30 09:18:01 2 47.22 0.00 1.95 0.05 0.12 50.67 09:53:30 09:18:01 3 47.27 0.00 1.98 0.05 0.12 50.58 09:53:30 09:19:01 all 31.65 0.00 0.96 0.23 0.10 67.05 09:53:30 09:19:01 0 31.17 0.00 0.99 0.59 0.12 67.14 09:53:30 09:19:01 1 33.23 0.00 0.90 0.00 0.10 65.76 09:53:30 09:19:01 2 31.51 0.00 0.67 0.08 0.10 67.63 09:53:30 09:19:01 3 30.70 0.00 1.29 0.27 0.10 67.65 09:53:30 09:20:01 all 5.19 0.00 0.32 0.01 0.09 94.39 09:53:30 09:20:01 0 5.36 0.00 0.35 0.03 0.08 94.17 09:53:30 09:20:01 1 5.28 0.00 0.35 0.00 0.10 94.26 09:53:30 09:20:01 2 4.70 0.00 0.34 0.02 0.08 94.87 09:53:30 09:20:01 3 5.41 0.00 0.24 0.00 0.08 94.27 09:53:30 09:53:30 09:20:01 CPU %user %nice %system %iowait %steal %idle 09:53:30 09:21:01 all 1.95 0.00 0.21 0.01 0.08 97.74 09:53:30 09:21:01 0 2.07 0.00 0.27 0.03 0.08 97.54 09:53:30 09:21:01 1 1.86 0.00 0.22 0.00 0.07 97.85 09:53:30 09:21:01 2 2.26 0.00 0.20 0.02 0.10 97.42 09:53:30 09:21:01 3 1.62 0.00 0.17 0.00 0.08 98.13 09:53:30 09:22:01 all 3.69 0.00 0.29 0.03 0.08 95.91 09:53:30 09:22:01 0 3.53 0.00 0.30 0.03 0.08 96.05 09:53:30 09:22:01 1 4.12 0.00 0.28 0.00 0.08 95.51 09:53:30 09:22:01 2 3.47 0.00 0.30 0.07 0.08 96.08 09:53:30 09:22:01 3 3.64 0.00 0.27 0.00 0.08 96.00 09:53:30 09:23:01 all 2.93 0.00 0.25 0.02 0.08 96.72 09:53:30 09:23:01 0 2.33 0.00 0.27 0.03 0.08 97.28 09:53:30 09:23:01 1 3.41 0.00 0.17 0.02 0.08 96.32 09:53:30 09:23:01 2 2.73 0.00 0.27 0.02 0.08 96.90 09:53:30 09:23:01 3 3.27 0.00 0.28 0.00 0.08 96.36 09:53:30 09:24:01 all 0.64 0.00 0.18 0.01 0.08 99.10 09:53:30 09:24:01 0 0.45 0.00 0.15 0.02 0.07 99.31 09:53:30 09:24:01 1 0.42 0.00 0.17 0.00 0.07 99.34 09:53:30 09:24:01 2 0.89 0.00 0.22 0.02 0.08 98.79 09:53:30 09:24:01 3 0.81 0.00 0.17 0.00 0.08 98.94 09:53:30 09:25:01 all 5.35 0.00 0.54 0.17 0.06 93.87 09:53:30 09:25:01 0 3.28 0.00 0.52 0.32 0.07 95.81 09:53:30 09:25:01 1 3.75 0.00 0.44 0.00 0.07 95.75 09:53:30 09:25:01 2 3.21 0.00 0.34 0.34 0.05 96.06 09:53:30 09:25:01 3 11.17 0.00 0.87 0.03 0.07 87.85 09:53:30 09:26:01 all 55.19 0.00 1.74 1.22 0.12 41.72 09:53:30 09:26:01 0 54.36 0.00 1.89 0.08 0.13 43.53 09:53:30 09:26:01 1 52.76 0.00 1.57 2.75 0.12 42.80 09:53:30 09:26:01 2 57.07 0.00 2.00 0.39 0.12 40.43 09:53:30 09:26:01 3 56.61 0.00 1.51 1.67 0.12 40.09 09:53:30 09:27:01 all 42.69 0.00 1.59 0.56 0.10 55.06 09:53:30 09:27:01 0 44.73 0.00 1.44 0.10 0.08 53.65 09:53:30 09:27:01 1 42.36 0.00 1.67 1.51 0.10 54.35 09:53:30 09:27:01 2 40.62 0.00 1.64 0.28 0.10 57.36 09:53:30 09:27:01 3 43.06 0.00 1.59 0.33 0.12 54.90 09:53:30 09:28:01 all 3.42 0.00 0.45 0.02 0.08 96.03 09:53:30 09:28:01 0 3.35 0.00 0.48 0.00 0.08 96.08 09:53:30 09:28:01 1 3.32 0.00 0.39 0.05 0.07 96.18 09:53:30 09:28:01 2 3.57 0.00 0.42 0.00 0.08 95.93 09:53:30 09:28:01 3 3.42 0.00 0.52 0.03 0.08 95.94 09:53:30 09:29:01 all 38.88 0.00 1.24 0.30 0.10 59.48 09:53:30 09:29:01 0 39.52 0.00 1.32 0.03 0.10 59.02 09:53:30 09:29:01 1 35.45 0.00 1.36 0.87 0.10 62.22 09:53:30 09:29:01 2 39.73 0.00 1.15 0.18 0.08 58.85 09:53:30 09:29:01 3 40.82 0.00 1.14 0.12 0.10 57.82 09:53:30 09:30:01 all 7.97 0.00 0.42 0.01 0.10 91.50 09:53:30 09:30:01 0 8.48 0.00 0.38 0.00 0.10 91.04 09:53:30 09:30:01 1 7.33 0.00 0.39 0.03 0.08 92.16 09:53:30 09:30:01 2 8.23 0.00 0.42 0.00 0.10 91.25 09:53:30 09:30:01 3 7.84 0.00 0.48 0.02 0.10 91.56 09:53:30 09:31:01 all 47.30 0.00 1.77 0.05 0.10 50.77 09:53:30 09:31:01 0 45.34 0.00 1.56 0.03 0.08 52.99 09:53:30 09:31:01 1 48.66 0.00 1.71 0.08 0.10 49.45 09:53:30 09:31:01 2 48.21 0.00 1.83 0.02 0.10 49.85 09:53:30 09:31:01 3 47.01 0.00 2.01 0.07 0.10 50.81 09:53:30 09:53:30 09:31:01 CPU %user %nice %system %iowait %steal %idle 09:53:30 09:32:01 all 33.81 0.00 1.39 0.11 0.10 64.58 09:53:30 09:32:01 0 33.64 0.00 1.27 0.02 0.12 64.96 09:53:30 09:32:01 1 31.52 0.00 1.30 0.30 0.12 66.76 09:53:30 09:32:01 2 38.59 0.00 1.92 0.12 0.08 59.29 09:53:30 09:32:01 3 31.51 0.00 1.07 0.02 0.10 67.30 09:53:30 09:33:01 all 36.04 0.00 1.07 0.58 0.10 62.21 09:53:30 09:33:01 0 33.99 0.00 0.79 0.00 0.10 65.12 09:53:30 09:33:01 1 35.28 0.00 1.16 1.71 0.10 61.75 09:53:30 09:33:01 2 37.00 0.00 1.22 0.60 0.10 61.08 09:53:30 09:33:01 3 37.90 0.00 1.09 0.02 0.10 60.89 09:53:30 09:34:01 all 42.32 0.00 1.68 0.31 0.10 55.58 09:53:30 09:34:01 0 41.49 0.00 1.74 0.05 0.10 56.61 09:53:30 09:34:01 1 40.97 0.00 1.59 0.18 0.10 57.16 09:53:30 09:34:01 2 42.86 0.00 1.57 0.95 0.10 54.52 09:53:30 09:34:01 3 43.96 0.00 1.81 0.07 0.12 54.05 09:53:30 09:35:01 all 39.31 0.00 1.21 0.28 0.10 59.11 09:53:30 09:35:01 0 38.95 0.00 1.32 0.55 0.12 59.07 09:53:30 09:35:01 1 40.11 0.00 1.40 0.03 0.08 58.38 09:53:30 09:35:01 2 37.77 0.00 1.26 0.05 0.10 60.81 09:53:30 09:35:01 3 40.41 0.00 0.85 0.49 0.08 58.17 09:53:30 09:36:01 all 6.35 0.00 0.39 0.02 0.09 93.15 09:53:30 09:36:01 0 7.17 0.00 0.33 0.03 0.07 92.40 09:53:30 09:36:01 1 5.53 0.00 0.47 0.03 0.10 93.86 09:53:30 09:36:01 2 5.75 0.00 0.37 0.00 0.10 93.78 09:53:30 09:36:01 3 6.95 0.00 0.38 0.00 0.10 92.56 09:53:30 09:37:01 all 1.12 0.00 0.23 0.01 0.07 98.58 09:53:30 09:37:01 0 0.57 0.00 0.25 0.02 0.07 99.10 09:53:30 09:37:01 1 2.54 0.00 0.18 0.02 0.08 97.18 09:53:30 09:37:01 2 0.53 0.00 0.33 0.00 0.05 99.08 09:53:30 09:37:01 3 0.80 0.00 0.15 0.00 0.08 98.96 09:53:30 09:38:01 all 2.45 0.00 0.16 0.01 0.06 97.32 09:53:30 09:38:01 0 8.29 0.00 0.20 0.02 0.07 91.42 09:53:30 09:38:01 1 0.90 0.00 0.13 0.02 0.05 98.90 09:53:30 09:38:01 2 0.23 0.00 0.08 0.00 0.03 99.65 09:53:30 09:38:01 3 0.39 0.00 0.22 0.00 0.08 99.31 09:53:30 09:39:01 all 44.52 0.00 1.61 0.38 0.10 53.39 09:53:30 09:39:01 0 47.21 0.00 1.56 0.47 0.10 50.66 09:53:30 09:39:01 1 44.82 0.00 1.04 0.25 0.08 53.81 09:53:30 09:39:01 2 41.47 0.00 2.15 0.03 0.12 56.23 09:53:30 09:39:01 3 44.57 0.00 1.69 0.77 0.10 52.87 09:53:30 09:40:01 all 20.31 0.00 0.72 0.48 0.09 78.40 09:53:30 09:40:01 0 20.00 0.00 0.87 0.00 0.10 79.03 09:53:30 09:40:01 1 19.65 0.00 0.63 1.45 0.10 78.17 09:53:30 09:40:01 2 21.46 0.00 0.68 0.47 0.07 77.33 09:53:30 09:40:01 3 20.14 0.00 0.69 0.02 0.08 79.07 09:53:30 09:41:01 all 13.67 0.00 0.73 0.05 0.07 85.47 09:53:30 09:41:01 0 13.18 0.00 0.72 0.00 0.07 86.03 09:53:30 09:41:01 1 14.09 0.00 0.65 0.02 0.08 85.16 09:53:30 09:41:01 2 13.81 0.00 1.04 0.18 0.08 84.88 09:53:30 09:41:01 3 13.62 0.00 0.52 0.00 0.07 85.80 09:53:30 09:42:01 all 47.04 0.00 1.13 0.25 0.10 51.47 09:53:30 09:42:01 0 49.95 0.00 1.19 0.42 0.10 48.34 09:53:30 09:42:01 1 47.11 0.00 1.67 0.59 0.10 50.53 09:53:30 09:42:01 2 45.68 0.00 0.74 0.00 0.10 53.48 09:53:30 09:42:01 3 45.43 0.00 0.92 0.00 0.10 53.55 09:53:30 09:53:30 09:42:01 CPU %user %nice %system %iowait %steal %idle 09:53:30 09:43:02 all 2.56 0.00 0.20 0.01 0.07 97.16 09:53:30 09:43:02 0 2.76 0.00 0.25 0.00 0.08 96.90 09:53:30 09:43:02 1 2.41 0.00 0.20 0.03 0.07 97.29 09:53:30 09:43:02 2 2.61 0.00 0.15 0.02 0.07 97.16 09:53:30 09:43:02 3 2.44 0.00 0.20 0.00 0.07 97.29 09:53:30 09:44:01 all 2.73 0.00 0.21 0.02 0.08 96.96 09:53:30 09:44:01 0 2.71 0.00 0.19 0.00 0.07 97.04 09:53:30 09:44:01 1 2.93 0.00 0.22 0.03 0.09 96.73 09:53:30 09:44:01 2 2.68 0.00 0.26 0.03 0.09 96.94 09:53:30 09:44:01 3 2.60 0.00 0.19 0.00 0.07 97.14 09:53:30 09:45:01 all 1.75 0.00 0.14 0.01 0.08 98.03 09:53:30 09:45:01 0 1.74 0.00 0.13 0.00 0.08 98.04 09:53:30 09:45:01 1 1.74 0.00 0.13 0.02 0.08 98.02 09:53:30 09:45:01 2 2.00 0.00 0.13 0.02 0.07 97.78 09:53:30 09:45:01 3 1.52 0.00 0.15 0.00 0.07 98.26 09:53:30 09:46:01 all 2.85 0.00 0.25 0.01 0.07 96.82 09:53:30 09:46:01 0 2.85 0.00 0.25 0.00 0.07 96.83 09:53:30 09:46:01 1 2.71 0.00 0.20 0.05 0.07 96.97 09:53:30 09:46:01 2 2.78 0.00 0.33 0.00 0.08 96.80 09:53:30 09:46:01 3 3.04 0.00 0.22 0.00 0.07 96.67 09:53:30 09:47:01 all 2.84 0.00 0.18 0.01 0.07 96.90 09:53:30 09:47:01 0 3.18 0.00 0.17 0.00 0.08 96.56 09:53:30 09:47:01 1 2.67 0.00 0.08 0.05 0.07 97.13 09:53:30 09:47:01 2 2.84 0.00 0.20 0.00 0.07 96.89 09:53:30 09:47:01 3 2.64 0.00 0.25 0.00 0.07 97.04 09:53:30 09:48:01 all 2.47 0.00 0.22 0.00 0.07 97.23 09:53:30 09:48:01 0 2.73 0.00 0.25 0.00 0.07 96.95 09:53:30 09:48:01 1 2.35 0.00 0.17 0.02 0.07 97.40 09:53:30 09:48:01 2 2.24 0.00 0.20 0.00 0.07 97.49 09:53:30 09:48:01 3 2.58 0.00 0.25 0.00 0.08 97.09 09:53:30 09:49:01 all 55.22 0.00 1.58 0.35 0.10 42.75 09:53:30 09:49:01 0 57.04 0.00 1.67 0.02 0.12 41.16 09:53:30 09:49:01 1 58.61 0.00 1.74 1.32 0.10 38.22 09:53:30 09:49:01 2 51.20 0.00 1.70 0.02 0.10 46.99 09:53:30 09:49:01 3 54.03 0.00 1.21 0.05 0.08 44.63 09:53:30 09:50:01 all 8.64 0.00 0.28 0.02 0.07 90.99 09:53:30 09:50:01 0 8.26 0.00 0.23 0.02 0.07 91.43 09:53:30 09:50:01 1 8.82 0.00 0.33 0.03 0.05 90.76 09:53:30 09:50:01 2 8.94 0.00 0.23 0.00 0.07 90.76 09:53:30 09:50:01 3 8.55 0.00 0.32 0.03 0.08 91.01 09:53:30 09:51:01 all 9.69 0.00 0.40 0.01 0.08 89.82 09:53:30 09:51:01 0 9.42 0.00 0.46 0.02 0.08 90.02 09:53:30 09:51:01 1 9.95 0.00 0.38 0.02 0.08 89.57 09:53:30 09:51:01 2 9.50 0.00 0.39 0.00 0.07 90.05 09:53:30 09:51:01 3 9.90 0.00 0.37 0.00 0.07 89.66 09:53:30 09:52:01 all 5.10 0.00 0.26 0.03 0.08 94.54 09:53:30 09:52:01 0 4.80 0.00 0.27 0.00 0.08 94.85 09:53:30 09:52:01 1 5.11 0.00 0.27 0.10 0.08 94.44 09:53:30 09:52:01 2 5.39 0.00 0.27 0.00 0.08 94.26 09:53:30 09:52:01 3 5.09 0.00 0.24 0.00 0.07 94.61 09:53:30 09:53:01 all 21.35 0.00 1.19 0.61 0.09 76.76 09:53:30 09:53:01 0 16.06 0.00 1.09 0.18 0.07 82.60 09:53:30 09:53:01 1 31.66 0.00 1.15 1.07 0.10 66.02 09:53:30 09:53:01 2 22.12 0.00 1.69 0.22 0.10 75.87 09:53:30 09:53:01 3 15.54 0.00 0.82 0.97 0.08 82.58 09:53:30 09:53:30 Average: CPU %user %nice %system %iowait %steal %idle 09:53:30 Average: all 24.88 0.38 1.34 0.77 0.09 72.53 09:53:30 Average: 0 24.37 0.40 1.34 0.88 0.09 72.91 09:53:30 Average: 1 24.47 0.36 1.26 0.96 0.09 72.85 09:53:30 Average: 2 25.47 0.37 1.40 0.47 0.09 72.19 09:53:30 Average: 3 25.20 0.38 1.36 0.79 0.09 72.17 09:53:30 09:53:30 09:53:30