RestApi Automation
Using RestApi to Automate the Test cases -> Backup, Restore
Before Start
The Setup should be ready with Avamar server connected to vCenter and proxy registered with the Avamar Server.
Installation
Python Version --> Preferably 3.5.0 and above.
Use the package manager [pip] if possible the latest Version.
apt-get install python-pip
Other Libraries
bash pip install requests --> to install the requests module
bash pip install yaml --> For Yaml Configuration
bash pip install logging --> For Log creation
Usage
Fill the Config.yaml file for User Entries. Some of them are explained below,
Authorization : Authorization Token to access Avamar Server(Use Postman to retrieve one).
vCenterSessionId : Session Id of the vCenter server.
vmType : The type of VM whose backup has to be taken(Windows, Linux)
FolderPath : Folder where the VM is kept
NewVMName : While Restoring the New VM name
For Eg.
IP: 10.110.211.252
Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiUk9PVCIsInVzZXJfbmFtZSI6Ik1DVXNlciIsInNjb3BlIjpbIndyaXRlIl0sImRvbWFpbiI6Ii8iLCJhdXRob3JpemVkX2RvbWFpbiI6Ii8iLCJleHAiOjE1NTI2NDc2NzksImF1dGhvcml0aWVzIjpbIlJPT1QiXSwianRpIjoiNjBlZTUyNWItZjBmYi00NTE2LWIyMTEtYmZiNThiMzQ3Y2E3IiwiY2xpZW50X2lkIjoiM2MwNDFiODctNTIyYi00NThlLTgwZmYtYjY5MTZiMmU5N2JmIn0.EpkFA2litAI_CigsTK1s3GYFmG6BP48_EOj-IIPXgNX5-SwpDlg32-MP8XgCbMYXOpPLRUzlPnIIBA8jANBVL9Tg3esF_u2qmKU7CMLVyJTIfZhB9x1NAoE5S0_6Fb8Z68PkbUWkUYc0ubaoGEhMzc775bLxU4g_ULUdtkQSGKYCTg2CLnmqhONZaWTw5M83Y-L8qZ7T4DvgEbkWtXHZ0jdnLcSiAXtv1qX3rEESk8LYVSuvoeLIPSnNK50vydh_H_cPTw9jfF_J8Qfa5mTAAfnuzTZBPGtyA2zodtOin1yyEOC1VPz7HpHU-0NMOKF1YCVleZXzV35BdNw-JxBfS1c92BMZQoF-yqyTf1Q5qwGCMA0lghxd0ClNwTM4YCCe-o3FBcVeCWLehL5MyGDuLk0JI8uGRJPR7XHpwpy8KTSF8L_9A-0i3xS0ZZQf9AxTDIEMIheEAF0VWgu3ulZ92Ud_9qThICTUWvqkHonuLiKs2FoPxrGfFyOeSeLlaZEO
vCenterSessionId: 4f99479faf19893b1dd86507b7fcfc7e
vCenter: 10.110.211.168
PolicyName: Gsan-Policy
PolicyDomain: /10.110.211.168/VirtualMachines
Content-Type: application/json
VM_id: c146dd0ebed42ff4cd94460ddeb509fb6cbdf7e7
vmType: Windows
VcCid: 14bda782e11827a1c69201a43ac0e3cc2b4a24a8
Datastore: datastore1
FolderPath: /AVE_A10N_DC/vm/Automation/
NewVMName: Restore-VM-2019_18
ResourcePoolPath: /AVE_A10N_DC/host/10.110.211.22/Resources/Compute-ResourcePool/
DatacenterName: AVE_A10N_DC
Running
After filling the yaml file run the below command in the terminal,
python REST_Automation.py
Log file produced is
Contributing
All suggestions and trial are welcome.
Release files for RESTApi-prasanth 6.7.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| RESTApi_prasanth-6.7.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Release files / RESTApi_prasanth-6.7.0.2-py3-none-any.whl
| Download URL | RESTApi_prasanth-6.7.0.2-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1cd09869af202229c85ff1e64e4fde3d5801d5cffad20713a7d5421012af6298
|
|
BLAKE2b-256 checksum How to use checksums |
96a65dc6b78b223f43d0aef99bf33eb41b1b7d73dc1aa79ccfa6854519b95d2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
|