virl2_client 2.3.0__tar.gz → 2.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- virl2_client-2.4.1/PKG-INFO +151 -0
- virl2_client-2.4.1/README.md +120 -0
- {virl2_client-2.3.0 → virl2_client-2.4.1}/examples/licensing.py +17 -11
- {virl2_client-2.3.0 → virl2_client-2.4.1}/examples/link_conditioning.py +3 -3
- {virl2_client-2.3.0 → virl2_client-2.4.1}/examples/sample.py +7 -5
- {virl2_client-2.3.0 → virl2_client-2.4.1}/pyproject.toml +21 -10
- virl2_client-2.4.1/setup.py +35 -0
- virl2_client-2.3.0/virl2_client/exceptions.py → virl2_client-2.4.1/virl2_client/__init__.py +17 -18
- virl2_client-2.4.1/virl2_client/exceptions.py +55 -0
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/__init__.py +3 -3
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/authentication.py +12 -21
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/cl_pyats.py +25 -26
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/groups.py +6 -12
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/interface.py +97 -50
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/lab.py +364 -266
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/licensing.py +28 -29
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/link.py +43 -37
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/node.py +122 -76
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/node_image_definitions.py +11 -17
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/system.py +4 -10
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/models/users.py +4 -10
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/utils.py +7 -6
- {virl2_client-2.3.0 → virl2_client-2.4.1}/virl2_client/virl2_client.py +185 -133
- virl2_client-2.3.0/PKG-INFO +0 -115
- virl2_client-2.3.0/README.md +0 -89
- virl2_client-2.3.0/setup.py +0 -30
- virl2_client-2.3.0/virl2_client/__init__.py +0 -25
- {virl2_client-2.3.0 → virl2_client-2.4.1}/LICENSE +0 -0
- {virl2_client-2.3.0 → virl2_client-2.4.1}/examples/demo.ipynb +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: virl2-client
|
|
3
|
+
Version: 2.4.1
|
|
4
|
+
Summary: VIRL2 Client Library
|
|
5
|
+
Home-page: https://github.com/ciscodevnet/virl2-client
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Author: Simon Knight
|
|
8
|
+
Author-email: simknigh@cisco.com
|
|
9
|
+
Requires-Python: >=3.8.0,<4.0.0
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
19
|
+
Classifier: Topic :: System :: Networking
|
|
20
|
+
Provides-Extra: docs
|
|
21
|
+
Provides-Extra: pyats
|
|
22
|
+
Requires-Dist: pyats (>=22.4,<23.0); extra == "pyats"
|
|
23
|
+
Requires-Dist: requests (>=2,<3)
|
|
24
|
+
Requires-Dist: requests-toolbelt (>=0.9.1,<0.10.0)
|
|
25
|
+
Requires-Dist: sphinx (>=5,<6); extra == "docs"
|
|
26
|
+
Requires-Dist: sphinx_rtd_theme (>=1,<2); extra == "docs"
|
|
27
|
+
Requires-Dist: urllib3 (>=1.26.9,<2.0.0)
|
|
28
|
+
Project-URL: Repository, https://github.com/ciscodevnet/virl2-client
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
[](https://github.com/CiscoDevNet/virl2-client/actions/workflows/main.yml)
|
|
32
|
+
|
|
33
|
+
# VIRL 2 Client Library
|
|
34
|
+
|
|
35
|
+
> **Note:** The product has been renamed from *VIRL* to *Cisco Modeling Labs* /
|
|
36
|
+
> CML 2. References to VIRL still exist in the product documentation and within
|
|
37
|
+
> code or examples.
|
|
38
|
+
>
|
|
39
|
+
> The name of the package itself has not been changed. Throughout the
|
|
40
|
+
> documentation it is referred to as "virl2_client", "Python Client Library" or
|
|
41
|
+
> "PCL".
|
|
42
|
+
|
|
43
|
+
## Introduction
|
|
44
|
+
|
|
45
|
+
This is the client library for the *Cisco Modeling Labs* Platform
|
|
46
|
+
(`virl2_client`). It provides a Python package to programmatically create,
|
|
47
|
+
edit, delete and control network simulations on a CML 2 controller.
|
|
48
|
+
|
|
49
|
+
It is a pure Python implementation that requires Python 3. We've tested and
|
|
50
|
+
written the package with Python 3.8.10.
|
|
51
|
+
|
|
52
|
+
The status of the package can be considered **stable**. Issues with the
|
|
53
|
+
software should be raised via the [GitHub issue
|
|
54
|
+
tracker](https://github.com/CiscoDevNet/virl2-client/issues).
|
|
55
|
+
|
|
56
|
+
## Use Case Description
|
|
57
|
+
|
|
58
|
+
The client library provides a convenient interface to control the life-cycle of
|
|
59
|
+
a network simulation. This can be used for automation scripts directly in
|
|
60
|
+
Python but also for third party integrations / plugins which need to integrate
|
|
61
|
+
with a simulated network. Examples already existing are an [Ansible
|
|
62
|
+
plugin](https://github.com/CiscoDevNet/ansible-virl).
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
The package comes in form of a wheel that is downloadable from the CML
|
|
67
|
+
2 controller. The package can be installed either from PyPI using
|
|
68
|
+
|
|
69
|
+
pip3 install virl2_client
|
|
70
|
+
|
|
71
|
+
If you want to interact with devices via the client library, you need to
|
|
72
|
+
also install the pyATS library. This can be achieved in one go using
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
pip3 install "virl2_client[pyats]"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Note that this does *not* pull in the full pyATS package... See below how that is achieved.
|
|
79
|
+
|
|
80
|
+
or, alternatively, the version that is bundled with the CML 2 controller can
|
|
81
|
+
be downloaded to the local filesystem and then directly installed via
|
|
82
|
+
|
|
83
|
+
pip3 install ./virl2_client-*.whl
|
|
84
|
+
|
|
85
|
+
The bundled version is available on the index site of the docs when viewed
|
|
86
|
+
directly on the CML 2 controller.
|
|
87
|
+
|
|
88
|
+
Ensure to replace use the correct file name, replacing the wildcard with the
|
|
89
|
+
proper version/build information. For example
|
|
90
|
+
|
|
91
|
+
pip3 install virl2_client-2.0.0b10-py3-none-any.whl
|
|
92
|
+
|
|
93
|
+
We recommend the use of a virtual environment for installation.
|
|
94
|
+
|
|
95
|
+
If you require the full version of the pyATS library including things like Genie
|
|
96
|
+
then you need to do this in a subsequent step like shown here:
|
|
97
|
+
|
|
98
|
+
pip3 install "pyats[full]"
|
|
99
|
+
|
|
100
|
+
> **IMPORTANT**: The version of the Python client library must be compatible
|
|
101
|
+
> with the version of the controller. If you are running an older controller
|
|
102
|
+
> version then it's likely that the latest client library version from PyPI can
|
|
103
|
+
> **not** be used. In this case, you need to either use the version available
|
|
104
|
+
> from the controller itself or by specifying a version constraint.
|
|
105
|
+
>
|
|
106
|
+
> Example: When on a controller version 2.2.x, then you'd need to install with
|
|
107
|
+
> `pip3 install "virl2-client<2.3.0"`. This will ensure that the version
|
|
108
|
+
> installed is compatible with 2.2.x.
|
|
109
|
+
|
|
110
|
+
## Usage
|
|
111
|
+
|
|
112
|
+
The package itself is fairly well documented using *docstrings*. In addition, the
|
|
113
|
+
documentation is available in HTML format on the controller itself, via the
|
|
114
|
+
"Tools -> Client Library" menu.
|
|
115
|
+
|
|
116
|
+
## Compatibility
|
|
117
|
+
|
|
118
|
+
This package and the used API is specific to CML 2. It is not
|
|
119
|
+
backwards compatible with VIRL 1.x and therefore can not be used with VIRL
|
|
120
|
+
1.x. If you are looking for a convenient tool to interface with the VIRL 1 API
|
|
121
|
+
then the [CML Utils tool](https://github.com/CiscoDevNet/virlutils) is
|
|
122
|
+
recommended.
|
|
123
|
+
|
|
124
|
+
## Known Issues
|
|
125
|
+
|
|
126
|
+
There are no major known issues at this point. See the comment in the *Introduction*
|
|
127
|
+
section. Also, see the *Issues* section in GitHub to learn about known issues or raise new ones, if needed. Also see [CHANGES](CHANGES.md).
|
|
128
|
+
|
|
129
|
+
## Getting Help
|
|
130
|
+
|
|
131
|
+
If you have questions, concerns, bug reports, etc., please create an issue
|
|
132
|
+
against the [repository on
|
|
133
|
+
GitHub](https://github.com/CiscoDevNet/virl2-client/)
|
|
134
|
+
|
|
135
|
+
## Getting Involved
|
|
136
|
+
|
|
137
|
+
We welcome contributions. Whether you fixed a bug, added a new feature or
|
|
138
|
+
corrected a typo, all contributions are welcome. General instructions on how to
|
|
139
|
+
contribute can be found in the [CONTRIBUTING](CONTRIBUTING.md) file.
|
|
140
|
+
|
|
141
|
+
## Licensing Info
|
|
142
|
+
|
|
143
|
+
This code is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for
|
|
144
|
+
details.
|
|
145
|
+
|
|
146
|
+
## References
|
|
147
|
+
|
|
148
|
+
This package is part of the CML 2 Network Simulation platform. For details, go
|
|
149
|
+
to <https://developer.cisco.com/modeling-labs>. Additional documentation for the
|
|
150
|
+
product is available at <https://developer.cisco.com/docs/modeling-labs>
|
|
151
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[](https://github.com/CiscoDevNet/virl2-client/actions/workflows/main.yml)
|
|
2
|
+
|
|
3
|
+
# VIRL 2 Client Library
|
|
4
|
+
|
|
5
|
+
> **Note:** The product has been renamed from *VIRL* to *Cisco Modeling Labs* /
|
|
6
|
+
> CML 2. References to VIRL still exist in the product documentation and within
|
|
7
|
+
> code or examples.
|
|
8
|
+
>
|
|
9
|
+
> The name of the package itself has not been changed. Throughout the
|
|
10
|
+
> documentation it is referred to as "virl2_client", "Python Client Library" or
|
|
11
|
+
> "PCL".
|
|
12
|
+
|
|
13
|
+
## Introduction
|
|
14
|
+
|
|
15
|
+
This is the client library for the *Cisco Modeling Labs* Platform
|
|
16
|
+
(`virl2_client`). It provides a Python package to programmatically create,
|
|
17
|
+
edit, delete and control network simulations on a CML 2 controller.
|
|
18
|
+
|
|
19
|
+
It is a pure Python implementation that requires Python 3. We've tested and
|
|
20
|
+
written the package with Python 3.8.10.
|
|
21
|
+
|
|
22
|
+
The status of the package can be considered **stable**. Issues with the
|
|
23
|
+
software should be raised via the [GitHub issue
|
|
24
|
+
tracker](https://github.com/CiscoDevNet/virl2-client/issues).
|
|
25
|
+
|
|
26
|
+
## Use Case Description
|
|
27
|
+
|
|
28
|
+
The client library provides a convenient interface to control the life-cycle of
|
|
29
|
+
a network simulation. This can be used for automation scripts directly in
|
|
30
|
+
Python but also for third party integrations / plugins which need to integrate
|
|
31
|
+
with a simulated network. Examples already existing are an [Ansible
|
|
32
|
+
plugin](https://github.com/CiscoDevNet/ansible-virl).
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
The package comes in form of a wheel that is downloadable from the CML
|
|
37
|
+
2 controller. The package can be installed either from PyPI using
|
|
38
|
+
|
|
39
|
+
pip3 install virl2_client
|
|
40
|
+
|
|
41
|
+
If you want to interact with devices via the client library, you need to
|
|
42
|
+
also install the pyATS library. This can be achieved in one go using
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
pip3 install "virl2_client[pyats]"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Note that this does *not* pull in the full pyATS package... See below how that is achieved.
|
|
49
|
+
|
|
50
|
+
or, alternatively, the version that is bundled with the CML 2 controller can
|
|
51
|
+
be downloaded to the local filesystem and then directly installed via
|
|
52
|
+
|
|
53
|
+
pip3 install ./virl2_client-*.whl
|
|
54
|
+
|
|
55
|
+
The bundled version is available on the index site of the docs when viewed
|
|
56
|
+
directly on the CML 2 controller.
|
|
57
|
+
|
|
58
|
+
Ensure to replace use the correct file name, replacing the wildcard with the
|
|
59
|
+
proper version/build information. For example
|
|
60
|
+
|
|
61
|
+
pip3 install virl2_client-2.0.0b10-py3-none-any.whl
|
|
62
|
+
|
|
63
|
+
We recommend the use of a virtual environment for installation.
|
|
64
|
+
|
|
65
|
+
If you require the full version of the pyATS library including things like Genie
|
|
66
|
+
then you need to do this in a subsequent step like shown here:
|
|
67
|
+
|
|
68
|
+
pip3 install "pyats[full]"
|
|
69
|
+
|
|
70
|
+
> **IMPORTANT**: The version of the Python client library must be compatible
|
|
71
|
+
> with the version of the controller. If you are running an older controller
|
|
72
|
+
> version then it's likely that the latest client library version from PyPI can
|
|
73
|
+
> **not** be used. In this case, you need to either use the version available
|
|
74
|
+
> from the controller itself or by specifying a version constraint.
|
|
75
|
+
>
|
|
76
|
+
> Example: When on a controller version 2.2.x, then you'd need to install with
|
|
77
|
+
> `pip3 install "virl2-client<2.3.0"`. This will ensure that the version
|
|
78
|
+
> installed is compatible with 2.2.x.
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
The package itself is fairly well documented using *docstrings*. In addition, the
|
|
83
|
+
documentation is available in HTML format on the controller itself, via the
|
|
84
|
+
"Tools -> Client Library" menu.
|
|
85
|
+
|
|
86
|
+
## Compatibility
|
|
87
|
+
|
|
88
|
+
This package and the used API is specific to CML 2. It is not
|
|
89
|
+
backwards compatible with VIRL 1.x and therefore can not be used with VIRL
|
|
90
|
+
1.x. If you are looking for a convenient tool to interface with the VIRL 1 API
|
|
91
|
+
then the [CML Utils tool](https://github.com/CiscoDevNet/virlutils) is
|
|
92
|
+
recommended.
|
|
93
|
+
|
|
94
|
+
## Known Issues
|
|
95
|
+
|
|
96
|
+
There are no major known issues at this point. See the comment in the *Introduction*
|
|
97
|
+
section. Also, see the *Issues* section in GitHub to learn about known issues or raise new ones, if needed. Also see [CHANGES](CHANGES.md).
|
|
98
|
+
|
|
99
|
+
## Getting Help
|
|
100
|
+
|
|
101
|
+
If you have questions, concerns, bug reports, etc., please create an issue
|
|
102
|
+
against the [repository on
|
|
103
|
+
GitHub](https://github.com/CiscoDevNet/virl2-client/)
|
|
104
|
+
|
|
105
|
+
## Getting Involved
|
|
106
|
+
|
|
107
|
+
We welcome contributions. Whether you fixed a bug, added a new feature or
|
|
108
|
+
corrected a typo, all contributions are welcome. General instructions on how to
|
|
109
|
+
contribute can be found in the [CONTRIBUTING](CONTRIBUTING.md) file.
|
|
110
|
+
|
|
111
|
+
## Licensing Info
|
|
112
|
+
|
|
113
|
+
This code is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for
|
|
114
|
+
details.
|
|
115
|
+
|
|
116
|
+
## References
|
|
117
|
+
|
|
118
|
+
This package is part of the CML 2 Network Simulation platform. For details, go
|
|
119
|
+
to <https://developer.cisco.com/modeling-labs>. Additional documentation for the
|
|
120
|
+
product is available at <https://developer.cisco.com/docs/modeling-labs>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
#
|
|
3
|
-
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
4
|
-
#
|
|
5
3
|
# This file is part of VIRL 2
|
|
4
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
5
|
+
# All rights reserved.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
7
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
8
8
|
#
|
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
10
|
# you may not use this file except in compliance with the License.
|
|
@@ -97,24 +97,26 @@ Prints:
|
|
|
97
97
|
},
|
|
98
98
|
"reservation_mode": false,
|
|
99
99
|
"transport": {
|
|
100
|
-
"ssms": "https://
|
|
100
|
+
"ssms": "https://smartreceiver.cisco.com/licservice/license",
|
|
101
101
|
"proxy": {
|
|
102
102
|
"server": null,
|
|
103
103
|
"port": null
|
|
104
104
|
},
|
|
105
|
-
"default_ssms": "https://
|
|
105
|
+
"default_ssms": "https://smartreceiver.cisco.com/licservice/license"
|
|
106
106
|
},
|
|
107
107
|
"features": [
|
|
108
108
|
{
|
|
109
109
|
"name": "CML - Enterprise License",
|
|
110
|
-
"description": "Cisco Modeling Labs - Enterprise License with 20 nodes
|
|
110
|
+
"description": "Cisco Modeling Labs - Enterprise License with 20 nodes \
|
|
111
|
+
capacity included",
|
|
111
112
|
"in_use": 1,
|
|
112
113
|
"status": "IN_COMPLIANCE",
|
|
113
114
|
"version": "1.0"
|
|
114
115
|
},
|
|
115
116
|
{
|
|
116
117
|
"name": "CML \u2013 Expansion Nodes",
|
|
117
|
-
"description": "Cisco Modeling Labs - Expansion node capacity for CML
|
|
118
|
+
"description": "Cisco Modeling Labs - Expansion node capacity for CML \
|
|
119
|
+
Enterprise Servers",
|
|
118
120
|
"in_use": 50,
|
|
119
121
|
"status": "IN_COMPLIANCE",
|
|
120
122
|
"version": "1.0"
|
|
@@ -129,9 +131,11 @@ Prints:
|
|
|
129
131
|
|
|
130
132
|
[
|
|
131
133
|
{
|
|
132
|
-
"id": "regid.2019-10.com.cisco.CML_ENT_BASE
|
|
134
|
+
"id": "regid.2019-10.com.cisco.CML_ENT_BASE,\
|
|
135
|
+
1.0_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
|
|
133
136
|
"name": "CML - Enterprise License",
|
|
134
|
-
"description": "Cisco Modeling Labs - Enterprise License with 20 nodes
|
|
137
|
+
"description": "Cisco Modeling Labs - Enterprise License with 20 nodes \
|
|
138
|
+
capacity included",
|
|
135
139
|
"in_use": 1,
|
|
136
140
|
"status": "IN_COMPLIANCE",
|
|
137
141
|
"version": "1.0",
|
|
@@ -139,9 +143,11 @@ Prints:
|
|
|
139
143
|
"max": 1
|
|
140
144
|
},
|
|
141
145
|
{
|
|
142
|
-
"id": "regid.2019-10.com.cisco.CML_NODE_COUNT
|
|
146
|
+
"id": "regid.2019-10.com.cisco.CML_NODE_COUNT,\
|
|
147
|
+
1.0_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
|
|
143
148
|
"name": "CML \u2013 Expansion Nodes",
|
|
144
|
-
"description": "Cisco Modeling Labs - Expansion node capacity for
|
|
149
|
+
"description": "Cisco Modeling Labs - Expansion node capacity for \
|
|
150
|
+
CML Enterprise Servers",
|
|
145
151
|
"in_use": 50,
|
|
146
152
|
"status": "IN_COMPLIANCE",
|
|
147
153
|
"version": "1.0",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
#
|
|
3
|
-
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
4
|
-
#
|
|
5
3
|
# This file is part of VIRL 2
|
|
4
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
5
|
+
# All rights reserved.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
7
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
8
8
|
#
|
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
10
|
# you may not use this file except in compliance with the License.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
#
|
|
3
|
-
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
4
|
-
#
|
|
5
3
|
# This file is part of VIRL 2
|
|
4
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
5
|
+
# All rights reserved.
|
|
6
6
|
#
|
|
7
|
-
#
|
|
7
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
8
8
|
#
|
|
9
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
10
|
# you may not use this file except in compliance with the License.
|
|
@@ -51,7 +51,9 @@ cl = ClientLibrary("http://localhost:8001", "cml2", "cml2cml2", allow_http=True)
|
|
|
51
51
|
cl.is_system_ready(wait=True)
|
|
52
52
|
|
|
53
53
|
# set transport if needed - also proxy can be set if needed
|
|
54
|
-
# cl.licensing.licensing.set_transport(
|
|
54
|
+
# cl.licensing.licensing.set_transport(
|
|
55
|
+
# ssms=ssms, proxy_server="172.16.1.100", proxy_port=8888
|
|
56
|
+
# )
|
|
55
57
|
cl.licensing.set_transport(ssms=SSMS)
|
|
56
58
|
cl.licensing.install_certificate(cert=CERT)
|
|
57
59
|
# 'register_wait' method waits max 45s for registration status to become COMPLETED
|
|
@@ -94,5 +96,5 @@ assert [link for link in lab.links() if link.state is not None] == []
|
|
|
94
96
|
status = cl.licensing.deregister()
|
|
95
97
|
cl.licensing.remove_certificate()
|
|
96
98
|
# set licensing back to default transport
|
|
97
|
-
# default ssms is "https://
|
|
99
|
+
# default ssms is "https://smartreceiver.cisco.com/licservice/license"
|
|
98
100
|
cl.licensing.set_default_transport()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "virl2_client"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.4.1"
|
|
4
4
|
description = "VIRL2 Client Library"
|
|
5
5
|
authors = ["Simon Knight <simknigh@cisco.com>", "Ralph Schmieder <rschmied@cisco.com>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -20,22 +20,33 @@ classifiers = [
|
|
|
20
20
|
]
|
|
21
21
|
|
|
22
22
|
[tool.poetry.dependencies]
|
|
23
|
-
python = "^3.
|
|
23
|
+
python = "^3.8.0"
|
|
24
24
|
requests = "^2"
|
|
25
25
|
requests-toolbelt = "^0.9.1"
|
|
26
|
+
urllib3 = "^1.26.9"
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
# For integration tests, pyATS is needed (Unicon)
|
|
28
|
+
# optional pyATS package
|
|
29
29
|
# (this pulls in a lot more dependencies)
|
|
30
|
-
#
|
|
30
|
+
# it does not pull in genie, need to specify extras=["full"] for pyATS.
|
|
31
|
+
# pyats = {extras=["full"], version = "^22.4", optional = true}
|
|
32
|
+
pyats = {version = "^22.4", optional = true}
|
|
33
|
+
|
|
34
|
+
# needed to build documentation, technically, this is a dev-dependency
|
|
35
|
+
# https://github.com/python-poetry/poetry/pull/606 -- no support
|
|
36
|
+
sphinx_rtd_theme = {version="^1", optional = true}
|
|
37
|
+
sphinx = {version="^5", optional = true}
|
|
38
|
+
|
|
39
|
+
[tool.poetry.dev-dependencies]
|
|
40
|
+
flake8 = "^4.0.1"
|
|
41
|
+
pre-commit = "^2.17.0"
|
|
31
42
|
pytest = "*"
|
|
32
43
|
requests-mock = "^1.9.2"
|
|
33
|
-
responses = "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
responses = "^0.20.0"
|
|
45
|
+
|
|
46
|
+
[tool.poetry.extras]
|
|
47
|
+
pyats = ["pyats"]
|
|
48
|
+
docs = ["sphinx", "sphinx_rtd_theme"]
|
|
37
49
|
|
|
38
50
|
[build-system]
|
|
39
51
|
requires = ["poetry>=1.1.8"]
|
|
40
52
|
build-backend = "poetry.masonry.api"
|
|
41
|
-
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
packages = \
|
|
5
|
+
['virl2_client', 'virl2_client.models']
|
|
6
|
+
|
|
7
|
+
package_data = \
|
|
8
|
+
{'': ['*']}
|
|
9
|
+
|
|
10
|
+
install_requires = \
|
|
11
|
+
['requests-toolbelt>=0.9.1,<0.10.0', 'requests>=2,<3', 'urllib3>=1.26.9,<2.0.0']
|
|
12
|
+
|
|
13
|
+
extras_require = \
|
|
14
|
+
{'docs': ['sphinx_rtd_theme>=1,<2', 'sphinx>=5,<6'],
|
|
15
|
+
'pyats': ['pyats>=22.4,<23.0']}
|
|
16
|
+
|
|
17
|
+
setup_kwargs = {
|
|
18
|
+
'name': 'virl2-client',
|
|
19
|
+
'version': '2.4.1',
|
|
20
|
+
'description': 'VIRL2 Client Library',
|
|
21
|
+
'long_description': '[](https://github.com/CiscoDevNet/virl2-client/actions/workflows/main.yml)\n\n# VIRL 2 Client Library\n\n> **Note:** The product has been renamed from *VIRL* to *Cisco Modeling Labs* /\n> CML 2. References to VIRL still exist in the product documentation and within\n> code or examples.\n>\n> The name of the package itself has not been changed. Throughout the\n> documentation it is referred to as "virl2_client", "Python Client Library" or\n> "PCL".\n\n## Introduction\n\nThis is the client library for the *Cisco Modeling Labs* Platform\n(`virl2_client`). It provides a Python package to programmatically create,\nedit, delete and control network simulations on a CML 2 controller.\n\nIt is a pure Python implementation that requires Python 3. We\'ve tested and\nwritten the package with Python 3.8.10.\n\nThe status of the package can be considered **stable**. Issues with the\nsoftware should be raised via the [GitHub issue\ntracker](https://github.com/CiscoDevNet/virl2-client/issues).\n\n## Use Case Description\n\nThe client library provides a convenient interface to control the life-cycle of\na network simulation. This can be used for automation scripts directly in\nPython but also for third party integrations / plugins which need to integrate\nwith a simulated network. Examples already existing are an [Ansible\nplugin](https://github.com/CiscoDevNet/ansible-virl).\n\n## Installation\n\nThe package comes in form of a wheel that is downloadable from the CML\n2 controller. The package can be installed either from PyPI using\n\n pip3 install virl2_client\n\nIf you want to interact with devices via the client library, you need to\nalso install the pyATS library. This can be achieved in one go using\n\n```\npip3 install "virl2_client[pyats]"\n```\n\nNote that this does *not* pull in the full pyATS package... See below how that is achieved.\n\nor, alternatively, the version that is bundled with the CML 2 controller can\nbe downloaded to the local filesystem and then directly installed via\n\n pip3 install ./virl2_client-*.whl\n\nThe bundled version is available on the index site of the docs when viewed\ndirectly on the CML 2 controller.\n\nEnsure to replace use the correct file name, replacing the wildcard with the\nproper version/build information. For example\n\n pip3 install virl2_client-2.0.0b10-py3-none-any.whl\n\nWe recommend the use of a virtual environment for installation.\n\nIf you require the full version of the pyATS library including things like Genie\nthen you need to do this in a subsequent step like shown here:\n\n pip3 install "pyats[full]"\n\n> **IMPORTANT**: The version of the Python client library must be compatible\n> with the version of the controller. If you are running an older controller\n> version then it\'s likely that the latest client library version from PyPI can\n> **not** be used. In this case, you need to either use the version available\n> from the controller itself or by specifying a version constraint.\n>\n> Example: When on a controller version 2.2.x, then you\'d need to install with\n> `pip3 install "virl2-client<2.3.0"`. This will ensure that the version\n> installed is compatible with 2.2.x.\n\n## Usage\n\nThe package itself is fairly well documented using *docstrings*. In addition, the\ndocumentation is available in HTML format on the controller itself, via the\n"Tools -> Client Library" menu.\n\n## Compatibility\n\nThis package and the used API is specific to CML 2. It is not\nbackwards compatible with VIRL 1.x and therefore can not be used with VIRL\n1.x. If you are looking for a convenient tool to interface with the VIRL 1 API\nthen the [CML Utils tool](https://github.com/CiscoDevNet/virlutils) is\nrecommended.\n\n## Known Issues\n\nThere are no major known issues at this point. See the comment in the *Introduction*\nsection. Also, see the *Issues* section in GitHub to learn about known issues or raise new ones, if needed. Also see [CHANGES](CHANGES.md).\n\n## Getting Help\n\nIf you have questions, concerns, bug reports, etc., please create an issue\nagainst the [repository on\nGitHub](https://github.com/CiscoDevNet/virl2-client/)\n\n## Getting Involved\n\nWe welcome contributions. Whether you fixed a bug, added a new feature or\ncorrected a typo, all contributions are welcome. General instructions on how to\ncontribute can be found in the [CONTRIBUTING](CONTRIBUTING.md) file.\n\n## Licensing Info\n\nThis code is licensed under the Apache 2.0 License. See [LICENSE](LICENSE) for\ndetails.\n\n## References\n\nThis package is part of the CML 2 Network Simulation platform. For details, go\nto <https://developer.cisco.com/modeling-labs>. Additional documentation for the\nproduct is available at <https://developer.cisco.com/docs/modeling-labs>\n',
|
|
22
|
+
'author': 'Simon Knight',
|
|
23
|
+
'author_email': 'simknigh@cisco.com',
|
|
24
|
+
'maintainer': 'None',
|
|
25
|
+
'maintainer_email': 'None',
|
|
26
|
+
'url': 'https://github.com/ciscodevnet/virl2-client',
|
|
27
|
+
'packages': packages,
|
|
28
|
+
'package_data': package_data,
|
|
29
|
+
'install_requires': install_requires,
|
|
30
|
+
'extras_require': extras_require,
|
|
31
|
+
'python_requires': '>=3.8.0,<4.0.0',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
setup(**setup_kwargs)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
3
|
-
#
|
|
4
2
|
# This file is part of VIRL 2
|
|
3
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
4
|
+
# All rights reserved.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
6
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
7
7
|
#
|
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
9
|
# you may not use this file except in compliance with the License.
|
|
@@ -18,18 +18,17 @@
|
|
|
18
18
|
# limitations under the License.
|
|
19
19
|
#
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
pass
|
|
21
|
+
from .exceptions import InterfaceNotFound, LabNotFound, LinkNotFound, NodeNotFound
|
|
22
|
+
from .virl2_client import ClientConfig, ClientLibrary, InitializationError
|
|
23
|
+
from .models.authentication import Context
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"InterfaceNotFound",
|
|
27
|
+
"LabNotFound",
|
|
28
|
+
"LinkNotFound",
|
|
29
|
+
"NodeNotFound",
|
|
30
|
+
"ClientConfig",
|
|
31
|
+
"ClientLibrary",
|
|
32
|
+
"InitializationError",
|
|
33
|
+
"Context",
|
|
34
|
+
]
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of VIRL 2
|
|
3
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
4
|
+
# All rights reserved.
|
|
5
|
+
#
|
|
6
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
7
|
+
#
|
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
# you may not use this file except in compliance with the License.
|
|
10
|
+
# You may obtain a copy of the License at
|
|
11
|
+
#
|
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
#
|
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
# See the License for the specific language governing permissions and
|
|
18
|
+
# limitations under the License.
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VirlException(Exception):
|
|
23
|
+
pass
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class InitializationError(VirlException):
|
|
27
|
+
pass
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ElementAlreadyExists(VirlException, FileExistsError):
|
|
31
|
+
pass
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ElementNotFound(VirlException, KeyError):
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class NodeNotFound(ElementNotFound):
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class LinkNotFound(ElementNotFound):
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class InterfaceNotFound(ElementNotFound):
|
|
47
|
+
pass
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class LabNotFound(ElementNotFound):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class DesynchronizedError(VirlException):
|
|
55
|
+
pass
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
3
|
-
#
|
|
4
2
|
# This file is part of VIRL 2
|
|
3
|
+
# Copyright (c) 2019-2022, Cisco Systems, Inc.
|
|
4
|
+
# All rights reserved.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
6
|
+
# Python bindings for the Cisco VIRL 2 Network Simulation Platform
|
|
7
7
|
#
|
|
8
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
9
|
# you may not use this file except in compliance with the License.
|