{"id":20588677,"url":"https://github.com/ciscodevnet/python-viptela","last_synced_at":"2025-04-06T03:10:48.321Z","repository":{"id":36614773,"uuid":"205420909","full_name":"CiscoDevNet/python-viptela","owner":"CiscoDevNet","description":"Cisco Viptela vManage Python CLI/SDK","archived":false,"fork":false,"pushed_at":"2024-01-05T00:23:25.000Z","size":519,"stargazers_count":97,"open_issues_count":34,"forks_count":65,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-04-04T17:55:19.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CiscoDevNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-30T16:41:07.000Z","updated_at":"2025-03-25T14:05:31.000Z","dependencies_parsed_at":"2024-06-21T07:11:31.868Z","dependency_job_id":"f24cf00f-95e9-4b86-be34-3cea4c0a643a","html_url":"https://github.com/CiscoDevNet/python-viptela","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpython-viptela","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpython-viptela/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpython-viptela/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CiscoDevNet%2Fpython-viptela/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CiscoDevNet","download_url":"https://codeload.github.com/CiscoDevNet/python-viptela/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T07:25:50.908Z","updated_at":"2025-04-06T03:10:48.302Z","avatar_url":"https://github.com/CiscoDevNet.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cisco Viptela vManage Python SDK/CLI/Ansible\n\nThis repo contains a Python SDK for Cisco Viptela vManage as well as a CLI and Ansible modules that leverage the SDK.\nStable releases are found in pypi.  The `master` branch is under active development and may not offer a stable interface.\n\n* [SDK](https://python-viptela.readthedocs.io/en/latest/)\n* [CLI](#vmanage-command-line-interface)\n* [Ansible Modules](ansible/README.md)\n\n## Requirements\n* Python 3.6+\n\n## Installation\n\n### Creating Python virtual environment\n\n```bash\npython3 -m venv env\n. env/bin/activate\n```\n\n### Installation from PyPI\n\n```bash\npip install viptela\n```\n\n### Installation from github \n\n```bash\npip install git+https://github.com/CiscoDevNet/python-viptela.git@specific_branch\n```\n\n### Installation from within repo\n\n```bash\ngit clone https://github.com/CiscoDevNet/python-viptela.git\ncd python-viptela\npip install -e .\n```\n\n## Environment Variables\n\nIP/DNS, port and credentials for the vManage server can be set for the SDK via environment variable\n\n* `VMANAGE_HOST`\n* `VMANAGE_PORT`\n* `VMANAGE_USERNAME`\n* `VMANAGE_PASSWORD`\n\n## vManage Command Line Interface\n\n```bash\nUsage: vmanage [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --host TEXT      vManage Host (env: VMANAGE_HOST)  [required]\n  --port INTEGER   vManage Port (env: VMANAGE_PORT, default=443)\n  --username TEXT  vManage Username (env: VMANAGE_USERNAME)  [required]\n  --password TEXT  vManage Password (env: VMANAGE_PASSWORD)  [required]\n  --help           Show this message and exit.\n\nCommands:\n  activate     Activate commands\n  certificate  Certficate commands\n  clean        Clean vManage\n  deactivate   Deactivate commands\n  export       Export commands\n  import       Import commands\n  set          vManage Settings set commands\n  show         Show commands\n```\n\nvManage host and credentials can be also specified via command line options.  The\ncommand line options override the environment variables. If no password is specified,\nthe user will be prompted for one.\n\n### Importing and exporting of templates and policy\n\n#### Data file format\n\nAll template information is exported to a single file with to lists: `feature_templates` and `device_templates`.  Each list contains dictionaries as pulled from the vManage API with a few\nadditions and modifications.  First, a list of attached devices and a list of input variables\nis added to the device template.  Then instance IDs are translated into name so that the templates\ncan be imported into another vManage.\n\nAll policy template information is exported to a single file with four lists: `policy_lists`,\n`policy_definitions`, `central_policies`, `local_policies`.  Each list contains dictionaries as\npulled from the vManage API with the instance IDs converted to names so that policies can be\nimported into another vManage.\n\n#### Import Options\n\n* `--check`: Just check. No changes. (default=False)\n* `--update`: Update if exists (default=False)\n* `--diff`: Show diffs (default=False)\n\nThe CLI/SDK will import templates and policy idempotently and as non-destructivly as possible.\nIt will only add templates and policies that are not there.  When a template or policy does exist\nbut is different than what is in the import file, it will not he updates unless the `--update`\noption is given.\n\n#### Export Templates\n\n##### Export all templates to a file\n\n```bash\nvmanage export templates --file vmanage-templates.json\n```\n\n##### Export templates from a specific vManange\n\n```bash\nvmanage --host=192.133.178.54 export templates --file vmanage-templates.json\n```\n\n##### Export specific device templates\n\n```bash\nvmanage export templates --type=device --file vmanage-templates.json --name=isr4331 --name=ISR1111-8P\n```\n\n##### Export just feature templates\n\n```bash\nvmanage export templates --type=feature --file vmanage-templates.json\n```\n\n#### Import Templates\n\n##### Import all templates\n\n```bash\nvmanage import templates --file vmanage-templates.json\n```\n\n##### Import feature templates\n\n```bash\nvmanage import templates --type=feature --file vmanage-templates.json\n```\n\n##### Import specific device templates\n\n```bash\nvmanage import templates --type=device --file vmanage-templates.json --name=isr4331 --name=ISR1111-8P\n```\n\n#### Export Policies\n\n```bash\nvmanage export policies --file vmanage-policies.json\n```\n\n#### Import Policies\n\n```bash\nvmanage import policies --file vmanage-policies.json\n```\n\n##### Diff two templates\n\n```bash\nvmanage show template g0/0/0-R1 --diff g0/0/0-R2\n[ ( 'change',\n    'templateDefinition.tunnel-interface.color.value.vipType',\n    ('ignore', 'constant')),\n  ( 'change',\n    'templateDefinition.tunnel-interface.color.value.vipValue',\n    ('default', 'custom2')),\n  ( 'add',\n    'templateDefinition.tunnel-interface.color.restrict',\n    [('vipVariableName', 'vpn_if_tunnel_color_restrict')]),\n  ( 'change',\n    'templateId',\n    ( '2a0481f4-a5b2-44bf-baad-59de4d3b4e99',\n      '1dc123db-7a14-40f5-9653-1c87ccd5eaa2')),\n  ('change', 'createdOn', (1569072320921, 1569072320260)),\n  ('change', '@rid', (843, 839)),\n  ( 'change',\n    'templateDescription',\n    ( 'G0/0/0 Interface for R1 router with TLOC extension, adds NAT',\n      'G0/0/0 Interface for R2 router with TLOC extension, adds NAT, changes '\n      'color to custom2')),\n  ('change', 'lastUpdatedOn', (1569072320921, 1569072320260))]\n```\n\n## License\n\nGNU General Public License v3.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fpython-viptela","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fciscodevnet%2Fpython-viptela","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fciscodevnet%2Fpython-viptela/lists"}