Skip to content

pyATS 実行方法#

参考#

実行例#

  • shell script から実行
  • 用意したtrigger_datafile.yaml にTriggerBlitz_sampleが記述されており、
  • testbed_topology.yaml に R1が存在すること。
  • DATE=date '+%Y%m%d_%H%M%S'
  • pyats run job job.py \ --testbed-file testbed_topology.yaml \ --trigger-uid=TriggerBlitz_sample \ --health-bg-file pyats_health.yaml --health-bg-devices R1 --helth-bg-checks logging --health-bg-interval-time logging:5 --archive-dir arvheives \ --archive-name test_$DATE \ | tee ./arvheives_$DATE.log

Warning

health-bg-file--health-bg-devices オプションは用意されていない可能性があるため要確認。

Info

tee コマンドにてファイルと標準出力にログを表示。

option 一覧#

option 一覧
Usage:
  pyats run job [file] [options]

Example
-------
  pyats run job /path/to/jobfile.py
  pyats run job /path/to/jobfile.py --testbed-file /path/to/testbed.yaml

Description:
  Runs a pyATS job file with the provided arguments, generating & report result.

Job Information:
  JOBFILE               target jobfile to be launched
  --job-uid             Unique ID identifiying this job run
  --pyats-configuration 
                        pyats configuration override file

Tasks:
  --task-uids LOGIC     Logic string to match task UIDs to run eg: "Or('Task-[12]')"

Mailing:
  --no-mail             disable report email notifications
  --mail-to             list of report email recipients
  --mail-subject        report email subject header
  --mail-html           enable html format report email

Reporting:
  --submitter           Specify the current submitter user id
  --image               Specify the image under test
  --release             Specify the release being tested
  --branch              Specify the branch being tested
  --meta                Specify some meta information as a dict. Supports a JSON string, a base64
                        encoded string, a URL, a file path, or an individual ("=" separated)
                        key=value pair. Can be used multiple times in one command.
  --source-id           XPRESSO source - eg. xpresso-dev-1@cisco.com
  --no-xml-report       Disable generation of the XML Report

Runinfo:
  --no-archive          disable archive creation
  --no-archive-subdir   disable archive subdirectory creation
  --runinfo-dir         specify alternate runinfo directory
  --archive-dir         specify alternate archive directory
  --archive-name        specify alternate archive file name

Liveview:
  --liveview            Starts a liveview server in a separate process
  --liveview-host HOST  Specify host for liveview server. Default is localhost
  --liveview-port PORT  Specify port for liveview server.
  --liveview-hostname HOSTNAME
                        Displayed hostname for liveview.
  --liveview-displayed-url LIVEVIEW_DISPLAYED_URL
                        Displayed url for liveview, for example, http://<liveview_hostname>:<port>
  --liveview-keepalive  Keep log viewer server alive after the run finishes.
  --liveview-callback-url LIVEVIEW_CALLBACK_URL
                        Specify xpresso callback url for jenkins run.
  --liveview-callback-token LIVEVIEW_CALLBACK_TOKEN
                        Specify xpresso token for jenkins run.

Testbed:
  -t, --testbed-file    Specify testbed file location

Clean:
  --clean-file FILE [FILE ...]
                        Specify clean file location(s). Multiple clean files can be specified by
                        separating them with spaces.
  --clean-devices [ ...]
                        Specify list of devices to clean, separated by spaces. To clean groups of
                        devices sequentially, specify as "[[dev1, dev2], dev3]".
  --clean-scope {job,task}
                        Specify whether clean runs before job or per task
  --invoke-clean        Clean is only invoked if this parameter is specified.
  --clean-device-image  [ ...]
                        list of clean images per device in format device:/path/to/image.bin
  --clean-os-image  [ ...]
                        list of clean images per OS in format os:/path/to/image.bin
  --clean-group-image  [ ...]
                        list of clean images per group in format group:/path/to/image.bin
  --clean-platform-image  [ ...]
                        list of clean images per platform in format platform:/path/to/image.bin
  --clean-image-json  [ ...]
                        dictionary of clean images in JSON string

Bringup:
  --logical-testbed-file 
                        Specify logical testbed file location

Rerun:
  --rerun-file FILE     rerun.results file that contains the information of tasks and testcases
  --rerun-task  [ ...]  TASKID TESTSCRIPT [TESTCASES...] Details to identify a specific Task to
                        rerun. Can be used multiple times for multiple tasks.
  --rerun-condition  [ ...]
                        Results type list for the condition of rerun plugin.

xUnit:
  --xunit [DIR]         Generate xunit report in the provided location. If used as a flag, generates
                        xunit reports runtime directory

HTML Logging:
  --html-logs [DIR]     Directory to generate HTML logs in addition to any existing log files. Note
                        - will increase archive size due to log duplication.

mapleClean:
  --maple-testsuite TESTSUITE_FILE
                        Specify maple yaml file

pyATS Health:
  --health-file HEALTH_FILE
                        Specify health yaml file
  --health-tc-sections HEALTH_TC_SECTIONS
                        Specify sections where to run pyATS Health Check. Regex is supported. You
                        can also filter based on class type. e.g. type:TestCase
  --health-tc-uids HEALTH_TC_UIDS
                        Specify triggers uids where to run pyATS Health Check. Regex is supported
  --health-tc-groups HEALTH_TC_GROUPS
                        Specify groups where to run pyATS Health Check. Regex is supported
  --health-config HEALTH_CONFIG
                        Specify pyATS Health Check configuration yaml file
  --health-remote-device [HEALTH_REMOTE_DEVICE ...]
                        Specify remote device information for copy files to remote
  --health-mgmt-vrf [HEALTH_MGMT_VRF ...]
                        Specify Mgmt Vrf which is reachable to remote device
  --health-threshold [HEALTH_THRESHOLD ...]
                        Specify threshold for cpu, memory
  --health-show-logging-keywords [HEALTH_SHOW_LOGGING_KEYWORDS ...]
                        Specify logging keywords to search
  --health-clear-logging
                        Specify logging keywords to search
  --health-core-default-dir [HEALTH_CORE_DEFAULT_DIR ...]
                        Specify directories where to search for core files
  --health-checks [HEALTH_CHECKS ...]
                        Specify checks to run
  --health-devices [HEALTH_DEVICES ...]
                        Specify devices which checks run against
  --health-notify-webex
                        Flag to send webex notification

TopologyUpPlugin:
  --check-all-devices-up
                        Enable/Disable checking for topology up pre job execution
  --connection-check-timeout CONNECTION_CHECK_TIMEOUT
                        Total time allowed for checking devices connectivity
  --connection-check-interval CONNECTION_CHECK_INTERVAL
                        Time to sleep between device connectivity checks

WebEx:
  --webex-token         Webex Bot AUTH Token
  --webex-space         Webex Space ID to send notification to
  --webex-email         Email of specific user to send WebEx notification to

General Options:
  -h, --help            Show help information
  -v, --verbose         Give more output, additive up to 3 times.
  -q, --quiet           Give less output, additive up to 3 times, corresponding to WARNING, ERROR,
                        and CRITICAL logging levels

argument --archive-dir: expected one argument