from shutil import rmtree
import threading
import time
+import traceback
from unittest.mock import Mock
from importlib_metadata import entry_points
except (vimconn.VimConnException, NsWorkerException) as e:
retries += 1
+ self.logger.debug(traceback.format_exc())
if retries < self.max_retries_inject_ssh_key:
return (
"BUILD",
import logging
import socket
import sys
+import traceback
import warnings
import paramiko
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(
- ip_addr, username=user, password=password, pkey=pkey, timeout=10
+ ip_addr, username=user, password=password, pkey=pkey, timeout=30
)
for command in commands:
- (i, o, e) = client.exec_command(command, timeout=10)
+ (i, o, e) = client.exec_command(command, timeout=30)
returncode = o.channel.recv_exit_status()
outerror = e.read()
if returncode != 0:
text = "run_command='{}' Error='{}'".format(command, outerror)
+ self.logger.debug(traceback.format_tb(e.__traceback__))
raise VimConnUnexpectedResponse(
"Cannot inject ssh key in VM: '{}'".format(text)
)
-
return
except (
socket.error,
paramiko.AuthenticationException,
paramiko.SSHException,
) as message:
+ self.logger.debug(traceback.format_exc())
raise VimConnUnexpectedResponse(
"Cannot inject ssh key in VM: '{}' - {}".format(
ip_addr, str(message)
)
)
-
return
# Optional methods
--- /dev/null
+#######################################################################################
+# Copyright ETSI Contributors and Others.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#######################################################################################
+---
+other:
+ - |
+ If there are more than one VNF in a NS, sometimes ssh key injection is failing in the second VNF.
+ Adding traceback and increasing the paramiko ssh client connection timeout from 10 second to 30 second.