pyATSについて
pythonで開発されたテスト自動化ソリューションです。
Cisco社の社内エンジニアがテストフレームワークとして利用していた物がOSSとして公開されています。
オプション
pyATSは自動化ソリューションのコアの部分に該当しています。 その他にも様々なオプションが用意されています。
- pyATS: コアフレームワーク
- Genie: pyATS標準ライブラリ
- unicon: 機器への接続ライブラリ
- XPRESSO: pyATS Webダッシュボード
などなど。
インストール方法
早速インストールしてみましょう。
Pythonを自端末にインストールしてあることが前提条件となります。Versionは3.5以降である必要があります※python 2 は未サポート
Python 3.5.x Python 3.6.x Python 3.7.x Python 3.8.x
まず、今回pyATSをインストールする仮想環境を用意します。
仮想環境名は2020年の11月という意味を込めて、pyats20-11にしました。
usalab!:Desktop $ mkdir pyats20-11 usalab!:Desktop $ cd pyats20-11/ usalab!:pyats20-11 $ python -m venv . usalab!:pyats20-11 $ source bin/activate . (pyats20-11) usalab!:pyats20-11 $
続いて仮想環境内のpipをupgradeします。
(pyats20-11) usalab!:pyats20-11 $ pip install --upgrade pip Collecting pip Downloading https://files.pythonhosted.org/packages/cb/28/91f26bd088ce8e22169032100d4260614fc3da435025ff389ef1d396a433/pip-20.2.4-py2.py3-none-any.whl (1.5MB) |████████████████████████████████| 1.5MB 7.1MB/s Installing collected packages: pip Found existing installation: pip 19.2.3 Uninstalling pip-19.2.3: Successfully uninstalled pip-19.2.3 Successfully installed pip-20.2.4
これでpyATSをインストールする下準備が整いました。
puATSはpipでインストール可能です。
インストール時に実行可能なコマンドは以下の表の通りになります。
Installation option | Command | Includes |
---|---|---|
全て | $ pip install pyats[full] | すべてのpyATSとpyATSライブラリのインフラストラクチャ(オプション含む) |
コア(pyATSのみ) | $ pip install pyats | pyATSのみ |
標準 | $ pip install pyats[library] | pyATSとpyATSライブラリ |
Robot Framework | $ pip install pyats[robot] | オプションのロボットフレームワークパッケージ |
テンプレート | $ pip install pyats[template] | 実行時に入力を促すテンプレートコマンドの使用を有効にする |
私は「全て」か「標準」でコマンド実行することが多いです。
今回は「標準」のコマンドでインストールを実行します。
(pyats20-11) usalab!:pyats20-11 $ pip install pyats[library] Collecting pyats[library] Downloading pyats-20.10-cp37-cp37m-macosx_10_10_x86_64.whl (503 kB) |████████████████████████████████| 503 kB 11.0 MB/s Collecting pyats.tcl<20.11.0,>=20.10.0 Downloading pyats.tcl-20.10-cp37-cp37m-macosx_10_10_x86_64.whl (532 kB) |████████████████████████████████| 532 kB 9.5 MB/s Collecting pyats.easypy<20.11.0,>=20.10.0 ~snip~ Successfully installed MarkupSafe-1.1.1 PrettyTable-2.0.0 aiohttp-3.7.3 async-timeout-3.0.1 attrs-20.3.0 certifi-2020.11.8 chardet-3.0.4 dill-0.3.3 distro-1.5.0 genie-20.10 genie.libs.clean-20.10.1 genie.libs.conf-20.10 genie.libs.filetransferutils-20.10 genie.libs.health-20.10 genie.libs.ops-20.10 genie.libs.parser-20.10 genie.libs.sdk-20.10 idna-2.10 importlib-metadata-3.0.0 jinja2-2.11.2 jsonpickle-1.4.1 junit-xml-1.9 multidict-5.0.2 netaddr-0.8.0 pathspec-0.8.1 ply-3.11 psutil-5.7.3 pyasn1-0.4.8 pyats-20.10 pyats.aereport-20.10 pyats.aetest-20.10 pyats.async-20.10 pyats.connections-20.10 pyats.datastructures-20.10 pyats.easypy-20.10 pyats.kleenex-20.10 pyats.log-20.10 pyats.reporter-20.10 pyats.results-20.10 pyats.tcl-20.10 pyats.topology-20.10 pyats.utils-20.10 pycryptodomex-3.9.9 pysmi-0.3.4 pysnmp-4.4.12 python-engineio-3.13.2 python-socketio-4.6.0 pyyaml-5.3.1 requests-2.25.0 ruamel.yaml-0.16.12 ruamel.yaml.clib-0.2.2 six-1.15.0 tqdm-4.53.0 typing-extensions-3.7.4.3 unicon-20.10 unicon.plugins-20.10 urllib3-1.26.2 wcwidth-0.2.5 wheel-0.35.1 xmltodict-0.12.0 yamllint-1.25.0 yarl-1.6.3 zipp-3.4.0 (pyats20-11) usalab!:pyats20-11 $
これでインストールは完了しました。
Version確認方法
インストールしたpyATSのversionを確認してみましょう
(pyats20-11) usalab!:pyats20-11 $ pyats version check You are currently running pyATS version: 20.10 Python: 3.7.5 [64bit] Package Version ---------------------------- ------- genie 20.10 genie.libs.clean 20.10.1 genie.libs.conf 20.10 genie.libs.filetransferutils 20.10 genie.libs.health 20.10 genie.libs.ops 20.10 genie.libs.parser 20.10 genie.libs.sdk 20.10 pyats 20.10 pyats.aereport 20.10 pyats.aetest 20.10 pyats.async 20.10 pyats.connections 20.10 pyats.datastructures 20.10 pyats.easypy 20.10 pyats.kleenex 20.10 pyats.log 20.10 pyats.reporter 20.10 pyats.results 20.10 pyats.tcl 20.10 pyats.topology 20.10 pyats.utils 20.10 unicon 20.10 unicon.plugins 20.10
Version 20.10 でインストールされたことが確認できました。
pyATSは開発が非常に早く、毎月新しいVersionが出てきます。
Versioningは非常にわかり易く、例えば2020年4月の更新の場合は20.4といったVersionになります。
今回は先月リリースされた20.10のVersionを入手しました。
次回以降、使い方を紹介していきます。
おまけ
インストール時に実行できるコマンド一通り実行しパッケージを確認してみました。
- [library] か[full]を実行しなかった場合Genieのパッケージがあまりインストールされませんでした。
- pyatsに関連する周辺パッケージのインストールなどにも差分がありました。fullで実施した際にはAnsibleなどもインストールされた(しかも2.10)
初めての利用なら[library]をで充分かと思います。
pip install pyats の場合
(pyats-core) usalab!:pyats-core $ pyats version check You are currently running pyATS version: 20.10 Python: 3.7.5 [64bit] Package Version -------------------- ------- pyats 20.10 pyats.aereport 20.10 pyats.aetest 20.10 pyats.async 20.10 pyats.connections 20.10 pyats.datastructures 20.10 pyats.easypy 20.10 pyats.kleenex 20.10 pyats.log 20.10 pyats.reporter 20.10 pyats.results 20.10 pyats.tcl 20.10 pyats.topology 20.10 pyats.utils 20.10 unicon 20.10 unicon.plugins 20.10
pip install pyats[template]の場合
(pyats-template) usalab!:pyats-template $ pyats version check You are currently running pyATS version: 20.10 Python: 3.7.5 [64bit] Package Version -------------------- ------- pyats 20.10 pyats.aereport 20.10 pyats.aetest 20.10 pyats.async 20.10 pyats.connections 20.10 pyats.datastructures 20.10 pyats.easypy 20.10 pyats.kleenex 20.10 pyats.log 20.10 pyats.reporter 20.10 pyats.results 20.10 pyats.tcl 20.10 pyats.topology 20.10 pyats.utils 20.10 unicon 20.10 unicon.plugins 20.10
pip install pyats[robot]の場合
(pyats-robot) usalab!:pyats-robot $ pyats version check You are currently running pyATS version: 20.10 Python: 3.7.5 [64bit] Package Version -------------------- ------- genie.libs.robot 20.10 pyats 20.10 pyats.aereport 20.10 pyats.aetest 20.10 pyats.async 20.10 pyats.connections 20.10 pyats.datastructures 20.10 pyats.easypy 20.10 pyats.kleenex 20.10 pyats.log 20.10 pyats.reporter 20.10 pyats.results 20.10 pyats.robot 20.10 pyats.tcl 20.10 pyats.topology 20.10 pyats.utils 20.10 unicon 20.10 unicon.plugins 20.10
pip install pyats[full]の場合
(pyats-full) usalab!:pyats-full $ pyats version check You are currently running pyATS version: 20.10 Python: 3.7.5 [64bit] Package Version ---------------------------- ------- genie 20.10 genie.libs.clean 20.10.1 genie.libs.conf 20.10 genie.libs.filetransferutils 20.10 genie.libs.health 20.10 genie.libs.ops 20.10 genie.libs.parser 20.10 genie.libs.robot 20.10 genie.libs.sdk 20.10 genie.telemetry 20.10 genie.trafficgen 20.10 pyats 20.10 pyats.aereport 20.10 pyats.aetest 20.10 pyats.async 20.10 pyats.connections 20.10 pyats.contrib 20.10.3 pyats.datastructures 20.10 pyats.easypy 20.10 pyats.kleenex 20.10 pyats.log 20.10 pyats.reporter 20.10 pyats.results 20.10 pyats.robot 20.10 pyats.tcl 20.10 pyats.topology 20.10 pyats.utils 20.10 unicon 20.10 unicon.plugins 20.10