Skip to content

Commit

Permalink
Merge pull request #251 from avinetworks/17.1.1-bug-fixes
Browse files Browse the repository at this point in the history
17.1.1 bug fixes
  • Loading branch information
Gaurav Rastogi authored May 3, 2017
2 parents d732bd2 + 5cee25f commit d997c8d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ python/avi/netscaler_converter/output/
python/avi/netscaler_converter/test/test_output/
.idea/
python/avi/migrationtools/output/
python/avi/migrationtools/f5_converter/output/
python/avi/migrationtools/netscaler_converter/output/
23 changes: 23 additions & 0 deletions python/avi/migrationtools/f5_converter/command_status.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ VERSION_11:
- "time-until-up"
- "description"
- "defaults-from"
- "partition"

Monitor_Indirect_Mappings:
- "up-interval"
Expand Down Expand Up @@ -111,6 +112,7 @@ VERSION_11:
- "defaults-from"
- "expiration"
- "method"
- "partition"

Persistence_supported_attr_convert_source_addr:
- "timeout"
Expand All @@ -124,6 +126,7 @@ VERSION_11:
- 'description'
- 'slow-ramp-time'
- 'reselect-tries'
- "partition"

Pool_supported_attr_convert_servers_config:
- 'address'
Expand Down Expand Up @@ -183,6 +186,7 @@ VERSION_11:
- 'ca-file'
- 'defaults-from'
- 'peer-cert-mode'
- "partition"

Profile_na_http:
- 'lws-width'
Expand All @@ -202,6 +206,7 @@ VERSION_11:
- "basic-auth-realm"
- "header-erase"
- "header-insert"
- "partition"

Profile_indirect_http:
- "request-chunking"
Expand All @@ -218,6 +223,7 @@ VERSION_11:
Profile_supported_dns:
- "description"
- "defaults-from"
- "partition"

Profile_indirect_dns:
- 'avr-dnsstat-sample-rate'
Expand All @@ -243,6 +249,7 @@ VERSION_11:
- "defaults-from"
- "keep-accept-encoding"
- "content-type-exclude"
- "partition"

Profile_na_hc:
- 'cpu-saver-high'
Expand All @@ -266,6 +273,7 @@ VERSION_11:
- "cache-uri-exclude"
- "cache-uri-include"
- "cache-max-entries"
- "partition"

Profile_indirect_wa:
- "cache-size"
Expand All @@ -278,6 +286,7 @@ VERSION_11:
- "software-syn-cookie"
- "pva-acceleration"
- "defaults-from"
- "partition"

profile_na_l4:
- "hardware-syn-cookie"
Expand Down Expand Up @@ -313,6 +322,7 @@ VERSION_11:
- "defaults-from"
- 'max-header-size'
- 'insert-xforwarded-for'
- "partition"

Profile_indirect_fh:
- 'reset-on-timeout'
Expand All @@ -338,6 +348,7 @@ VERSION_11:
- "congestion-control"
- "receive-window-size"
- "ip-tos-to-client"
- "partition"

Profile_indirect_tcp:
- 'reset-on-timeout'
Expand Down Expand Up @@ -374,6 +385,7 @@ VERSION_11:
- "idle-timeout"
- "datagram-load-balancing"
- "defaults-from"
- "partition"

Profile_indirect_udp:
- 'link-qos-to-client'
Expand All @@ -384,6 +396,7 @@ VERSION_11:
Profile_supported_oc:
- 'defaults-from'
- 'source-mask'
- "partition"

VS_supported_attr:
- 'profiles'
Expand All @@ -398,10 +411,15 @@ VERSION_11:
- 'rate-limit'
- 'connection-limit'
- 'rules'
- "partition"

VS_na_attr:
- 'vs-index'

VS_ignore_for_value:
'ip-protocol': 'tcp'
'translate-address': 'enabled'
'source-port': 'change'
'mask': ['255.255.255.255', 'any']

VS_unsupported_types:
Expand Down Expand Up @@ -435,6 +453,8 @@ VERSION_10:
- "description"
- "type"
- "defaults from"
- "partition"


Monitor_Indirect_Mappings:
- 'up interval'
Expand Down Expand Up @@ -686,6 +706,9 @@ VERSION_10:
- 'source'
- 'limit'

VS_na_attr:
- 'vs index'

VS_ignore_for_value:
'ip protocol': 'tcp'
'translate address': 'enabled'
Expand Down
10 changes: 9 additions & 1 deletion python/avi/migrationtools/f5_converter/conversion_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,12 @@ def get_tenant_ref(name):
if not parts[2]:
LOG.warning('Invalid tenant ref : %s' % name)
name = parts[2]
elif name and '/' in name:
parts = name.split('/')
tenant = parts[0]
name = parts[1]
if tenant.lower() == 'common':
tenant = 'admin'

return tenant, name

Expand Down Expand Up @@ -1060,7 +1066,7 @@ def format_string_to_json(avi_string):
try:
return json.loads(avi_string)
except Exception as e:
print e
LOG.error(e)
pass


Expand Down Expand Up @@ -1115,6 +1121,8 @@ def get_csv_skipped_list(csv_objects, name_of_object, vs_ref, field_key=None):
avi_objects = format_string_to_json(csv_object['Avi Object'])
if isinstance(avi_objects, dict):
avi_objects = [avi_objects]
if not avi_objects:
avi_objects = []
for avi_object_json in avi_objects:
object_found = False
if field_key:
Expand Down
19 changes: 12 additions & 7 deletions python/avi/migrationtools/f5_converter/profile_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,20 @@ def update_static_route(self, route):
"""

next_hop_ip = route.get('gw', None)
gateway = route.get('network', None)
ip_addr = gateway
ip_addr = route.get('network', None)

# Get the mask from subnet mask
if '%' in ip_addr:
ip_addr = ip_addr.split('%')[0]
if '/' in ip_addr:
ip_addr = ip_addr.split('/')[0]

# set subnet mask to 0.0.0.0 if its equal to default
if gateway == 'default':
if ip_addr == 'default':
ip_addr = '0.0.0.0'

# Get the mask from subnet mask
mask = sum([bin(int(x)).count('1') for x in ip_addr.split('.')])
if next_hop_ip and gateway:
if next_hop_ip and ip_addr:
static_route = {
"route_id": 1,
"prefix": {
Expand Down Expand Up @@ -266,6 +271,7 @@ def convert_profile(self, profile, key, f5_config, profile_config,
u_ignore = []
parent_cls = super(ProfileConfigConvV11, self)
profile_type, name = key.split(' ')

tenant, name = conv_utils.get_tenant_ref(name)
if not tenant_ref == 'admin':
tenant = tenant_ref
Expand All @@ -282,8 +288,7 @@ def convert_profile(self, profile, key, f5_config, profile_config,
u_ignore += user_ignore.get('server-ssl', [])
skipped = [attr for attr in profile.keys()
if attr not in supported_attr]
original_prof = profile_config.get('%s %s' % (profile_type, name),
None)
original_prof = profile_config.get(key, None)
inherit_key = original_prof.get('inherit-certkeychain', 'true')
if inherit_key == 'false':
profile['cert-key-chain'] = original_prof.get(
Expand Down
13 changes: 11 additions & 2 deletions python/avi/migrationtools/f5_converter/vs_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def get_instance(cls, version, f5_virtualservice_attributes):
if version in ['11', '12']:
return VSConfigConvV11(f5_virtualservice_attributes)


def get_persist_ref(self, f5_vs):
pass

Expand Down Expand Up @@ -220,7 +221,8 @@ def convert_vs(self, vs_name, f5_vs, vs_state, avi_config, snat_config,
"index": 1,
"redirect_action": {
"keep_query": True,
"status_code": "HTTP_REDIRECT_STATUS_CODE_302",
"status_code":
"HTTP_REDIRECT_STATUS_CODE_302",
"protocol": "HTTPS",
"port": 443
},
Expand Down Expand Up @@ -345,13 +347,16 @@ def convert_vs(self, vs_name, f5_vs, vs_state, avi_config, snat_config,
if rule != '_sys_https_redirect']
if skipped_rules:
skipped.append('rules: %s' % skipped_rules)

conv_status['na_list'] = [val for val in skipped if
val in self.vs_na_attr]
skipped = [attr for attr in skipped if attr not in self.vs_na_attr]
skipped = [attr for attr in skipped if attr not in user_ignore]
conv_status['skipped'] = skipped
status = final.STATUS_SUCCESSFUL
if skipped:
status = final.STATUS_PARTIAL
conv_status['status'] = status

conv_utils.add_conv_status('virtual', None, vs_name,
conv_status, vs_obj)

Expand All @@ -365,6 +370,8 @@ def __init__(self, f5_virtualservice_attributes):
f5_virtualservice_attributes['VS_ignore_for_value']
self.unsupported_types = \
f5_virtualservice_attributes['VS_unsupported_types']
self.vs_na_attr = \
f5_virtualservice_attributes['VS_na_attr']
self.connection_limit = 'connection-limit'

def get_persist_ref(self, f5_vs):
Expand All @@ -389,6 +396,8 @@ def __init__(self, f5_virtualservice_attributes):
self.supported_attr = f5_virtualservice_attributes['VS_supported_attr']
self.ignore_for_value = \
f5_virtualservice_attributes['VS_ignore_for_value']
self.vs_na_attr = \
f5_virtualservice_attributes['VS_na_attr']
self.unsupported_types = \
f5_virtualservice_attributes['VS_unsupported_types']
self.connection_limit = 'limit'
Expand Down
2 changes: 1 addition & 1 deletion python/avi/migrationtools/netscaler_converter/ns_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ def vs_per_skipped_setting_for_references(avi_config):
# Update the vs reference not in used if objects are not attached to
# VS directly or indirectly
for csv_object in csv_objects:
csv_object['VS Reference'] = STATUS_NOT_IN_USED
csv_object['VS Reference'] = STATUS_NOT_IN_USE


def write_status_report_and_pivot_table_in_xlsx(row_list, output_dir):
Expand Down

0 comments on commit d997c8d

Please sign in to comment.