aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/QemuUtils.py4
-rw-r--r--resources/libraries/python/ssh.py9
-rwxr-xr-xresources/tools/topo_installation.py3
3 files changed, 12 insertions, 4 deletions
diff --git a/resources/libraries/python/QemuUtils.py b/resources/libraries/python/QemuUtils.py
index 37a8863a2e..a4e14d2427 100644
--- a/resources/libraries/python/QemuUtils.py
+++ b/resources/libraries/python/QemuUtils.py
@@ -18,7 +18,7 @@ import json
from robot.api import logger
-from resources.libraries.python.ssh import SSH
+from resources.libraries.python.ssh import SSH, SSHTimeout
from resources.libraries.python.constants import Constants
from resources.libraries.python.topology import NodeType
@@ -519,7 +519,7 @@ class QemuUtils(object):
# Wait until VM boot
try:
self._wait_until_vm_boot()
- except RuntimeError:
+ except (RuntimeError, SSHTimeout):
self.qemu_kill()
self.qemu_clear_socks()
raise
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py
index 90ac0be2dc..3a2c1b661a 100644
--- a/resources/libraries/python/ssh.py
+++ b/resources/libraries/python/ssh.py
@@ -29,6 +29,11 @@ __all__ = ["exec_cmd", "exec_cmd_no_error"]
# TODO: load priv key
+class SSHTimeout(Exception):
+ """This exception is raised when a timeout occurs."""
+ pass
+
+
class SSH(object):
"""Contains methods for managing and using SSH connections."""
@@ -118,7 +123,7 @@ class SSH(object):
:type timeout: int
:return return_code, stdout, stderr
:rtype: tuple(int, str, str)
- :raise socket.timeout: If command is not finished in timeout time.
+ :raise SSHTimeout: If command is not finished in timeout time.
"""
start = time()
stdout = StringIO.StringIO()
@@ -144,7 +149,7 @@ class SSH(object):
stderr.write(chan.recv_stderr(self.__MAX_RECV_BUF))
if time() - start > timeout:
- raise socket.timeout(
+ raise SSHTimeout(
'Timeout exception.\n'
'Current contents of stdout buffer: {0}\n'
'Current contents of stderr buffer: {1}\n'
diff --git a/resources/tools/topo_installation.py b/resources/tools/topo_installation.py
index 5dbaaaa2f8..3a983962ad 100755
--- a/resources/tools/topo_installation.py
+++ b/resources/tools/topo_installation.py
@@ -22,6 +22,7 @@ from yaml import load
from resources.libraries.python.ssh import SSH
+
def ssh_no_error(ssh, cmd, sudo=False):
"""Execute a command over ssh channel, and log and exit if the command
fails.
@@ -47,6 +48,7 @@ def ssh_no_error(ssh, cmd, sudo=False):
return stdo
+
def ssh_ignore_error(ssh, cmd, sudo=False):
"""Execute a command over ssh channel, ignore errors.
@@ -70,6 +72,7 @@ def ssh_ignore_error(ssh, cmd, sudo=False):
return stdo
+
def main():
"""Copy and installation of VPP packages."""
n464' href='#n464'>464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679