Skip to main content

Connecting to a vCenter

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

vCenter-6.7.0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file vCenter-6.7.0.2-py3-none-any.whl.

File metadata

  • Download URL: vCenter-6.7.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for vCenter-6.7.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 008c7e38eab23bd4cef92b827117c0f7f65b93edfcc73746fbbff9e73d2d7ea5
MD5 4410a6f69b3891f39d1d953a4eff6ac2
BLAKE2b-256 e510f1a52485649dd20c3513f77342ca0c2b07faa5f6ae5729a4d07dd214fcd9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page