Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ederson.brilhante committed Jan 16, 2018
2 parents 6d35454 + 779dc02 commit 048f768
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
45 changes: 22 additions & 23 deletions networkapi/api_interface/facade.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,38 +349,37 @@ def get_vlan_range(interface):
vlan_range = ''
vlan_range_list = []
for env_int in env_ints:
#This test is not good. Has to be treated elsewhere with plugins
if interface.equipamento.modelo.marca.nome == "HP":
separator = ' to '
range_list_separator = ' '
else:
separator = '-'
range_list_separator = ','

if env_int.vlans:
vlan_range_temp = env_int.vlans
vlan_range_temp = vlan_range_temp.replace('-', separator)
vlan_range_list_temp = [vlan_range_temp]
else:
if interface.equipamento.modelo.marca.nome == "HP":
vlan_range_1 = str(env_int.ambiente.min_num_vlan_1) + \
' to ' + str(env_int.ambiente.max_num_vlan_1)
vlan_range_2 = str(env_int.ambiente.min_num_vlan_2) + \
' to ' + str(env_int.ambiente.max_num_vlan_2)
if vlan_range_1 is not vlan_range_2:
vlan_range_temp = vlan_range_1 + ' ' + vlan_range_2
vlan_range_list_temp = [vlan_range_1, vlan_range_2]
else:
vlan_range_temp = vlan_range_1
vlan_range_list_temp = [vlan_range_1]

vlan_range_1 = str(env_int.ambiente.min_num_vlan_1) + \
separator + str(env_int.ambiente.max_num_vlan_1)
vlan_range_2 = str(env_int.ambiente.min_num_vlan_2) + \
separator + str(env_int.ambiente.max_num_vlan_2)

if vlan_range_1 is not vlan_range_2:
vlan_range_temp = vlan_range_1 + range_list_separator + vlan_range_2
vlan_range_list_temp = [vlan_range_1, vlan_range_2]
else:
vlan_range_1 = str(env_int.ambiente.min_num_vlan_1) + \
'-' + str(env_int.ambiente.max_num_vlan_1)

vlan_range_2 = str(env_int.ambiente.min_num_vlan_2) + \
'-' + str(env_int.ambiente.max_num_vlan_2)
if vlan_range_1 is not vlan_range_2:
vlan_range_temp = vlan_range_1 + ',' + vlan_range_2
vlan_range_list_temp = [vlan_range_1, vlan_range_2]
else:
vlan_range_temp = vlan_range_1
vlan_range_list_temp = [vlan_range_1]
vlan_range_temp = vlan_range_1
vlan_range_list_temp = [vlan_range_1]

if vlan_range is '':
vlan_range = vlan_range_temp
vlan_range_list.extend(vlan_range_list_temp)
elif vlan_range_temp not in vlan_range:
vlan_range += ',' + vlan_range_temp
vlan_range += range_list_separator + vlan_range_temp
vlan_range_list.extend(vlan_range_list_temp)

if vlan_range == '':
Expand Down
2 changes: 0 additions & 2 deletions requirements_debug.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
django-pdb==0.5.1
pdb==0.1
virtualenv==15.1.0
ipdb==0.10.2

0 comments on commit 048f768

Please sign in to comment.