py3: nfv update range compatibility

Range returns a list on python2 and a range object on python3.

Convert to list where range is not iterated over.

This commit is split from Charles Short's work
Iecfe9b83245847b07aaaa0ec1aadad4734a9d118 and drops the usage
of the six library for six.moves.range as it is not needed.

Story: 2008454
Task: 42727
Co-authored-by: Charles Short <charles.short@windriver.com>
Signed-off-by: Dan Voiculeasa <dan.voiculeasa@windriver.com>
Change-Id: I97ca43b258e89ccd5f94ef17c768e5080fc946af
(cherry picked from commit 129036ccc4)
This commit is contained in:
Dan Voiculeasa 2021-06-29 11:59:42 +03:00 committed by Charles Short
parent a7b23615e3
commit a62dc15fee
3 changed files with 3 additions and 3 deletions

View File

@ -147,7 +147,7 @@ def setup_create_cmd(parser,
add_list_arg(create_cmd, '--alarm-restrictions', alarm_restrictions)
create_cmd.add_argument('--max-parallel-worker-hosts',
type=int,
choices=range(min_parallel, max_parallel + 1),
choices=list(range(min_parallel, max_parallel + 1)),
help='maximum worker hosts to update in parallel')
return create_cmd

View File

@ -267,7 +267,7 @@ class DHCPAgentRebalance(object):
def networks_are_balanced(self):
possible_agent_targets = range(0, len(self.num_networks_on_agents))
possible_agent_targets = list(range(0, len(self.num_networks_on_agents)))
# find the agent with the least amount of networks.
agent_with_least_networks = \

View File

@ -359,7 +359,7 @@ class L3AgentRebalance(object):
def routers_are_balanced(self):
possible_agent_targets = range(0, len(self.num_routers_on_agents))
possible_agent_targets = list(range(0, len(self.num_routers_on_agents)))
# find the agent with the least amount of routers.
agent_with_least_routers = \