cvproxy 1.0.7__tar.gz → 1.6.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cvproxy
3
- Version: 1.0.7
3
+ Version: 1.6.2
4
4
  Summary: CVProxy - CloudVision Proxy
5
5
  Author-email: Chris Mason <chris@netnix.org>
6
6
  License-Expression: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: pyavd<6
15
+ Requires-Dist: pyavd~=6.2.0
16
16
  Requires-Dist: jsonschema
17
17
  Dynamic: license-file
18
18
 
@@ -21,12 +21,12 @@ from http.server import HTTPServer, BaseHTTPRequestHandler, HTTPStatus
21
21
 
22
22
  from pyavd._cv.client import CVClient
23
23
  from pyavd._cv.workflows.deploy_to_cv import deploy_to_cv
24
- from pyavd._cv.workflows.models import CloudVision, CVDevice, CVEosConfig, CVDeviceTag, CVChangeControl
24
+ from pyavd._cv.workflows.models import CloudVision, CVDevice, CVEosConfig, CVDeviceTag, CVChangeControl, CVDeviceDeployment
25
25
 
26
26
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
27
27
  logging.getLogger().setLevel(logging.ERROR)
28
28
 
29
- __version__ = '1.0.7'
29
+ __version__ = '1.6.2'
30
30
 
31
31
  schema = {
32
32
  'unevaluatedProperties': False,
@@ -60,8 +60,8 @@ schema = {
60
60
 
61
61
  llock = threading.RLock()
62
62
 
63
- async def deploy(cv, configs, device_tags=[], change_control=False, strict_tags=False, delete_workspace=False):
64
- r = await deploy_to_cv(cloudvision=cv, configs=configs, change_control=change_control, device_tags=device_tags, strict_tags=strict_tags)
63
+ async def deploy(cv, device_deployments, change_control=False, strict_tags=False, delete_workspace=False):
64
+ r = await deploy_to_cv(change_control=change_control, cloudvision=cv, device_deployments=device_deployments, strict_tags=strict_tags)
65
65
 
66
66
  if delete_workspace and r.workspace.id and r.workspace.state == 'submitted':
67
67
  async with CVClient(servers=cv.servers, token=cv.token, username=cv.username, password=cv.password, verify_certs=cv.verify_certs) as cv_client:
@@ -101,7 +101,8 @@ class CVProxyRequest(BaseHTTPRequestHandler):
101
101
  self.status = None
102
102
 
103
103
  try:
104
- config_objects = []
104
+ device_deployments = []
105
+ tmp_files = []
105
106
 
106
107
  if 'Content-Length' in self.headers:
107
108
  postdata = self.rfile.read(int(self.headers['Content-Length']))
@@ -116,7 +117,11 @@ class CVProxyRequest(BaseHTTPRequestHandler):
116
117
  token = data['cv_token'],
117
118
  username = None,
118
119
  password = None,
119
- verify_certs = False
120
+ verify_certs = False,
121
+ proxy_host = None,
122
+ proxy_port = None,
123
+ proxy_username = None,
124
+ proxy_password = None
120
125
  )
121
126
 
122
127
  change_control = CVChangeControl(
@@ -133,9 +138,11 @@ class CVProxyRequest(BaseHTTPRequestHandler):
133
138
 
134
139
  with tempfile.NamedTemporaryFile(delete=False) as tmp:
135
140
  tmp.write(base64.b64decode(data['devices'][device]['configlet'], validate=True))
136
- config_objects.append(CVEosConfig(file=tmp.name, device=device_object, configlet_name=f'AVD-{device}'))
141
+ eos_config = CVEosConfig(file=tmp.name, device=device_object, configlet_name=f'AVD-{device}')
142
+ device_deployments.append(CVDeviceDeployment(device=device_object, eos_config=eos_config, device_tags=device_tags, interface_tags=[]))
143
+ tmp_files.append(tmp.name)
137
144
 
138
- r = asyncio.run(deploy(cloudvision, config_objects, device_tags, change_control, strict_tags=data.get('cv_strict_tags'), delete_workspace=data.get('cv_delete_workspace')))
145
+ r = asyncio.run(deploy(cloudvision, device_deployments, change_control, strict_tags=data.get('cv_strict_tags'), delete_workspace=data.get('cv_delete_workspace')))
139
146
 
140
147
  if r.failed:
141
148
  r.errors = [str(error) for error in r.errors]
@@ -164,8 +171,8 @@ class CVProxyRequest(BaseHTTPRequestHandler):
164
171
  r = ['application/json', 200, json.dumps(response, indent=2)]
165
172
 
166
173
  finally:
167
- for config_object in config_objects:
168
- os.remove(config_object.file)
174
+ for f in tmp_files:
175
+ os.remove(f)
169
176
 
170
177
  if r[0] == 'application/json':
171
178
  self.status = response['status']
@@ -21,12 +21,12 @@ from http.server import HTTPServer, BaseHTTPRequestHandler, HTTPStatus
21
21
 
22
22
  from pyavd._cv.client import CVClient
23
23
  from pyavd._cv.workflows.deploy_to_cv import deploy_to_cv
24
- from pyavd._cv.workflows.models import CloudVision, CVDevice, CVEosConfig, CVDeviceTag, CVChangeControl
24
+ from pyavd._cv.workflows.models import CloudVision, CVDevice, CVEosConfig, CVDeviceTag, CVChangeControl, CVDeviceDeployment
25
25
 
26
26
  urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
27
27
  logging.getLogger().setLevel(logging.ERROR)
28
28
 
29
- __version__ = '1.0.7'
29
+ __version__ = '1.6.2'
30
30
 
31
31
  schema = {
32
32
  'unevaluatedProperties': False,
@@ -60,8 +60,8 @@ schema = {
60
60
 
61
61
  llock = threading.RLock()
62
62
 
63
- async def deploy(cv, configs, device_tags=[], change_control=False, strict_tags=False, delete_workspace=False):
64
- r = await deploy_to_cv(cloudvision=cv, configs=configs, change_control=change_control, device_tags=device_tags, strict_tags=strict_tags)
63
+ async def deploy(cv, device_deployments, change_control=False, strict_tags=False, delete_workspace=False):
64
+ r = await deploy_to_cv(change_control=change_control, cloudvision=cv, device_deployments=device_deployments, strict_tags=strict_tags)
65
65
 
66
66
  if delete_workspace and r.workspace.id and r.workspace.state == 'submitted':
67
67
  async with CVClient(servers=cv.servers, token=cv.token, username=cv.username, password=cv.password, verify_certs=cv.verify_certs) as cv_client:
@@ -101,7 +101,8 @@ class CVProxyRequest(BaseHTTPRequestHandler):
101
101
  self.status = None
102
102
 
103
103
  try:
104
- config_objects = []
104
+ device_deployments = []
105
+ tmp_files = []
105
106
 
106
107
  if 'Content-Length' in self.headers:
107
108
  postdata = self.rfile.read(int(self.headers['Content-Length']))
@@ -116,7 +117,11 @@ class CVProxyRequest(BaseHTTPRequestHandler):
116
117
  token = data['cv_token'],
117
118
  username = None,
118
119
  password = None,
119
- verify_certs = False
120
+ verify_certs = False,
121
+ proxy_host = None,
122
+ proxy_port = None,
123
+ proxy_username = None,
124
+ proxy_password = None
120
125
  )
121
126
 
122
127
  change_control = CVChangeControl(
@@ -133,9 +138,11 @@ class CVProxyRequest(BaseHTTPRequestHandler):
133
138
 
134
139
  with tempfile.NamedTemporaryFile(delete=False) as tmp:
135
140
  tmp.write(base64.b64decode(data['devices'][device]['configlet'], validate=True))
136
- config_objects.append(CVEosConfig(file=tmp.name, device=device_object, configlet_name=f'AVD-{device}'))
141
+ eos_config = CVEosConfig(file=tmp.name, device=device_object, configlet_name=f'AVD-{device}')
142
+ device_deployments.append(CVDeviceDeployment(device=device_object, eos_config=eos_config, device_tags=device_tags, interface_tags=[]))
143
+ tmp_files.append(tmp.name)
137
144
 
138
- r = asyncio.run(deploy(cloudvision, config_objects, device_tags, change_control, strict_tags=data.get('cv_strict_tags'), delete_workspace=data.get('cv_delete_workspace')))
145
+ r = asyncio.run(deploy(cloudvision, device_deployments, change_control, strict_tags=data.get('cv_strict_tags'), delete_workspace=data.get('cv_delete_workspace')))
139
146
 
140
147
  if r.failed:
141
148
  r.errors = [str(error) for error in r.errors]
@@ -164,8 +171,8 @@ class CVProxyRequest(BaseHTTPRequestHandler):
164
171
  r = ['application/json', 200, json.dumps(response, indent=2)]
165
172
 
166
173
  finally:
167
- for config_object in config_objects:
168
- os.remove(config_object.file)
174
+ for f in tmp_files:
175
+ os.remove(f)
169
176
 
170
177
  if r[0] == 'application/json':
171
178
  self.status = response['status']
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cvproxy
3
- Version: 1.0.7
3
+ Version: 1.6.2
4
4
  Summary: CVProxy - CloudVision Proxy
5
5
  Author-email: Chris Mason <chris@netnix.org>
6
6
  License-Expression: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: pyavd<6
15
+ Requires-Dist: pyavd~=6.2.0
16
16
  Requires-Dist: jsonschema
17
17
  Dynamic: license-file
18
18
 
@@ -0,0 +1,2 @@
1
+ pyavd~=6.2.0
2
+ jsonschema
@@ -2,7 +2,7 @@
2
2
  name = "cvproxy"
3
3
  dynamic = ["version"]
4
4
  requires-python = ">= 3.10"
5
- dependencies = ["pyavd<6", "jsonschema"]
5
+ dependencies = ["pyavd~=6.2.0", "jsonschema"]
6
6
  authors = [{ name = "Chris Mason", email = "chris@netnix.org" }]
7
7
  description = "CVProxy - CloudVision Proxy"
8
8
  readme = "README.md"
@@ -1,2 +0,0 @@
1
- pyavd<6
2
- jsonschema
File without changes
File without changes
File without changes
File without changes