Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto updated assets for python eng #2958

Open
wants to merge 10 commits into
base: eng
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions python/avi/sdk/avi_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AviCredentials(object):
controller = ''
username = ''
password = ''
api_version = '18.2.6'
api_version = '20.1.1'
tenant = None
tenant_uuid = None
token = None
Expand Down Expand Up @@ -181,7 +181,7 @@ def update_from_ansible_module(self, m):
if m.params['password']:
self.password = m.params['password']
if (m.params['api_version'] and
(m.params['api_version'] != '18.2.6')):
(m.params['api_version'] != '20.1.1')):
self.api_version = m.params['api_version']
if m.params['tenant']:
self.tenant = m.params['tenant']
Expand Down Expand Up @@ -1128,7 +1128,8 @@ def _clean_inactive_sessions():
"for session ID: %s %s",
session, e)
pass
del session_cache[key]
if session_cache.get(key):
del session_cache[key]
logger.debug("Cleaned inactive session : %s", key)

def delete_session(self):
Expand All @@ -1139,7 +1140,7 @@ def delete_session(self):

def is_ipv6_address(self, controller_ip):
try:
logger.info('Verifing IPV6 Controller IP %s', controller_ip)
logger.info('Verifing Controller IP %s', controller_ip)
ip = ipaddress.ip_address(controller_ip)
return ip.version == self.IPV6
except ValueError as ve:
Expand Down
4 changes: 2 additions & 2 deletions python/avi/sdk/samples/autoscale/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from avi.sdk.utils.api_utils import ApiUtils
from avi.sdk.samples.common import get_sample_ssl_params
import traceback
from datetime import datetime
from datetime import datetime, timezone

log = get_root_logger(__name__, logfile_path='/opt/avi/log/sdkautoscale.log',
level=logging.DEBUG,
Expand Down Expand Up @@ -189,7 +189,7 @@ def asTimerCallback(self):
try:
if not self.api:
self.setupApiSession()
now = datetime.utcnow()
now = datetime.now(timezone.utc).replace(tzinfo=None)
vs_obj = self.api.get_object_by_name('virtualservice', self.vs_name)
if self.checkIfAutoScaleCooldown(vs_obj, now):
return
Expand Down
44 changes: 6 additions & 38 deletions python/avi/sdk/samples/clone_vs.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,18 @@ Specify the VIP as a subnet/mask. This must match an auto-allocation subnet in I

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

> -v auto (or -v *)

(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)
> -v *

### Specifying public/elastic/floating IP for clouds that support this (e.g. public clouds, OpenStack)

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:
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:

> -v 10.10.10.0/24;203.0.113.100
> -v 10.10.10.0/24;auto

### Avi Internal IPAM

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.
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.

## Special flags

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

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).

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.
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.

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

> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model vs example cloned-example -v auto
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model vs example cloned-example -v *

### Disabling learning in the cloned WAF Policy

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`:

> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model -flags disablelearning vs example cloned-example -v auto
> clone_vs.py -c controller1.acme.com -fc vs-wafpolicy,positive-security-model -flags disablelearning vs example cloned-example -v *

This flag can also be used when cloning a WAF Policy individually:

Expand Down Expand Up @@ -302,33 +300,3 @@ Changelog:
2.0.2:

* Added support for flexibly handling specification of pool placement networks for cloned pools

2.0.3:

* Added some additional reference handling for less-common DataScript and WAF Profile configurations

2.0.4:

* Fixed VRF handling for cloning to/from NSX-T Cloud in certain scenarios

2.0.5:

* Fixed VRF handling with manual VsVip

2.0.6:

* Changed handling of Pool and PoolGroup references in VsDataScriptSet
* 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)
* 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)
* Will generate a warning that DataScript code changes may be needed, for example because a Pool or PoolGroup name could not be preserved
* Changed handling of PoolGroup cloning
* Will now try to preserve the names of Pools when cloning a PoolGroup if possible (e.g. when cloning to a different tenant/Controller)
* 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)

2.0.7:

* Add support for cloning HealthMonitors with SSL attributes or authentication attributes (authentication attributes must be manually re-entered)
* Add support for cloning AuthProfiles for OAuth2
* Add support for cloning VS with OAuth2 SSO configuration
* Add support for cloning VS with service-level network/application profile overrides
* Add support for cloning DNS VS with Topology Policies
Loading