Skip to content

Commit 6d00530

Browse files
committed
Updated assets for python
Signed-off-by: gurunath-avi <[email protected]>
1 parent 911aef4 commit 6d00530

File tree

15 files changed

+1115
-1169
lines changed

15 files changed

+1115
-1169
lines changed

python/avi/sdk/avi_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import logging
99
import time
1010
import ipaddress
11-
import socket
1211

1312
if sys.version_info < (3, 5):
1413
from urlparse import urlparse
@@ -147,7 +146,7 @@ class AviCredentials(object):
147146
controller = ''
148147
username = ''
149148
password = ''
150-
api_version = '18.2.6'
149+
api_version = '20.1.1'
151150
tenant = None
152151
tenant_uuid = None
153152
token = None
@@ -181,7 +180,7 @@ def update_from_ansible_module(self, m):
181180
if m.params['password']:
182181
self.password = m.params['password']
183182
if (m.params['api_version'] and
184-
(m.params['api_version'] != '18.2.6')):
183+
(m.params['api_version'] != '20.1.1')):
185184
self.api_version = m.params['api_version']
186185
if m.params['tenant']:
187186
self.tenant = m.params['tenant']
@@ -1128,7 +1127,8 @@ def _clean_inactive_sessions():
11281127
"for session ID: %s %s",
11291128
session, e)
11301129
pass
1131-
del session_cache[key]
1130+
if session_cache.get(key):
1131+
del session_cache[key]
11321132
logger.debug("Cleaned inactive session : %s", key)
11331133

11341134
def delete_session(self):
@@ -1139,7 +1139,7 @@ def delete_session(self):
11391139

11401140
def is_ipv6_address(self, controller_ip):
11411141
try:
1142-
logger.info('Verifing IPV6 Controller IP %s', controller_ip)
1142+
logger.info('Verifing Controller IP %s', controller_ip)
11431143
ip = ipaddress.ip_address(controller_ip)
11441144
return ip.version == self.IPV6
11451145
except ValueError as ve:

python/avi/sdk/csp_avi_api.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,12 @@
77

88
from avi.sdk.avi_api import ApiSession, \
99
sessionDict, APIError, AviCredentials
10-
import os
1110
import sys
12-
import copy
13-
import json
1411
import logging
1512
import time
1613

17-
if sys.version_info < (3, 5):
18-
from urlparse import urlparse
19-
else:
20-
from urllib.parse import urlparse
21-
22-
from datetime import datetime, timedelta
2314
from requests import ConnectionError
24-
from requests import Response
2515
from requests.exceptions import ChunkedEncodingError
26-
from requests.sessions import Session
2716
from ssl import SSLError
2817

2918
logger = logging.getLogger(__name__)

python/avi/sdk/samples/autoscale/autoscaler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from avi.sdk.utils.api_utils import ApiUtils
2121
from avi.sdk.samples.common import get_sample_ssl_params
2222
import traceback
23-
from datetime import datetime
23+
from datetime import datetime, timezone
2424

2525
log = get_root_logger(__name__, logfile_path='/opt/avi/log/sdkautoscale.log',
2626
level=logging.DEBUG,
@@ -189,7 +189,7 @@ def asTimerCallback(self):
189189
try:
190190
if not self.api:
191191
self.setupApiSession()
192-
now = datetime.utcnow()
192+
now = datetime.now(timezone.utc).replace(tzinfo=None)
193193
vs_obj = self.api.get_object_by_name('virtualservice', self.vs_name)
194194
if self.checkIfAutoScaleCooldown(vs_obj, now):
195195
return

python/avi/sdk/samples/clone_vs.md

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,18 @@ Specify the VIP as a subnet/mask. This must match an auto-allocation subnet in I
7272

7373
If the source VIP was auto-allocated, the target can simply inherit the auto-allocation network:
7474

75-
> -v auto (or -v *)
76-
77-
(Note: On Linux/Unix/Mac systems, use the `auto` option as `*` would need to be escaped to prevent it being treated as a filename glob)
75+
> -v *
7876
7977
### Specifying public/elastic/floating IP for clouds that support this (e.g. public clouds, OpenStack)
8078

81-
Separate the public/floating IP using a `;`. A static public/floating IP can be specified explicitly, or to auto-allocate a public IP, use the `auto` keyword:
79+
Separate the public/floating IP using a `;`. A static public/floating IP can be specified explicitly, or o auto-allocate a public IP, use the `auto` keyword:
8280

8381
> -v 10.10.10.0/24;203.0.113.100
8482
> -v 10.10.10.0/24;auto
8583
8684
### Avi Internal IPAM
8785

88-
When using Avi Internal IPAM for auto-allocation, it may be necessary in some clouds (e.g. NSX-T Cloud) to supply the `-int` parameter to ensure the VsVip is populated with all the correct fields. Other clouds (e.g. vCenter Cloud) are more forgiving and generally work without specifying this parameter if there is only a single IPAM subnet specified.
86+
When using Avi Internal IPAM for auto-allocation, it may be necessary in some clouds (e.g. NSX-T Cloud) to supply the `-int` parameter to ensure the VsVip is populated with all the correct fields. Other clouds (e.g. vCenter Cloud) are more forgiving and usually work without specifying this parameter.
8987

9088
## Special flags
9189

@@ -214,17 +212,17 @@ If cloning a Virtual Service between Controllers or to a different tenant, the d
214212

215213
A WAF Policy and its referenced PSM groups can be forced cloned using the -fc flag. This supports the scenarios where the cloned VS should have its own WAF Policy rather than sharing the same WAF policy (including the case where learning is enabled).
216214

217-
In this case, if learning is enabled in the source WAF Policy, it will remain enabled in the cloned WAF Policy resulting in independent learning for the cloned VS.
215+
In this case, if learning is enabled in the source WAF Policy, it will remain enabled in the cloned WAF Policy resulting in indepdent learning for the cloned VS.
218216

219217
The below example clones a VS and forces cloning of the WAF Policy and any PSM groups also.
220218

221-
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model vs example cloned-example -v auto
219+
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model vs example cloned-example -v *
222220
223221
### Disabling learning in the cloned WAF Policy
224222

225223
It may desirable to disable learning for the cloned WAF Policy and its referenced PSM groups, for example if the source Virtual Service was used for learning and the cloned Virtual Service will be an instance of the same application, but independent learning is not desired. This can be achieved with the option `-flags disablelearning`:
226224

227-
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model -flags disablelearning vs example cloned-example -v auto
225+
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model -flags disablelearning vs example cloned-example -v *
228226
229227
This flag can also be used when cloning a WAF Policy individually:
230228

@@ -302,33 +300,3 @@ Changelog:
302300
2.0.2:
303301

304302
* Added support for flexibly handling specification of pool placement networks for cloned pools
305-
306-
2.0.3:
307-
308-
* Added some additional reference handling for less-common DataScript and WAF Profile configurations
309-
310-
2.0.4:
311-
312-
* Fixed VRF handling for cloning to/from NSX-T Cloud in certain scenarios
313-
314-
2.0.5:
315-
316-
* Fixed VRF handling with manual VsVip
317-
318-
2.0.6:
319-
320-
* Changed handling of Pool and PoolGroup references in VsDataScriptSet
321-
* Will now try to preserve the names of Pools and PoolGroups when cloning a VsDataScriptSet if possible (e.g. when cloning to a different tenant/Controller)
322-
* If name preservation is not possible, unique names will now be generated from the old Pool/PoolGroup name (previous behaviour was to generate names based on VsDataScript name)
323-
* Will generate a warning that DataScript code changes may be needed, for example because a Pool or PoolGroup name could not be preserved
324-
* Changed handling of PoolGroup cloning
325-
* Will now try to preserve the names of Pools when cloning a PoolGroup if possible (e.g. when cloning to a different tenant/Controller)
326-
* If name preservation is not possible, unique names will now be generated from the old Pool name (previous behaviour was to generate names based on PoolGroup name)
327-
328-
2.0.7:
329-
330-
* Add support for cloning HealthMonitors with SSL attributes or authentication attributes (authentication attributes must be manually re-entered)
331-
* Add support for cloning AuthProfiles for OAuth2
332-
* Add support for cloning VS with OAuth2 SSO configuration
333-
* Add support for cloning VS with service-level network/application profile overrides
334-
* Add support for cloning DNS VS with Topology Policies

0 commit comments

Comments
 (0)