diff options
author | DR695H <dr695h@att.com> | 2019-05-01 18:52:33 -0400 |
---|---|---|
committer | DR695H <dr695h@att.com> | 2019-05-01 18:53:14 -0400 |
commit | ae6fedd18ad51f175d6a2e2346f284a68b6e4967 (patch) | |
tree | 40cf730e4178000533b83ebffdf6abe04011ce06 /robotframework-onap/vcpeutils/vcpecommon.py | |
parent | 308b44cc1e6b95df3051e5f7db94389696763cca (diff) |
support python 3
support python 3 in all files, also support python 2 however so
everything should continue to work
Change-Id: I4ace08d2bb0623c0fdc61f2fe39d2339817aa916
Issue-ID: TEST-141
Signed-off-by: DR695H <dr695h@att.com>
Diffstat (limited to 'robotframework-onap/vcpeutils/vcpecommon.py')
-rwxr-xr-x | robotframework-onap/vcpeutils/vcpecommon.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/robotframework-onap/vcpeutils/vcpecommon.py b/robotframework-onap/vcpeutils/vcpecommon.py index 95b5bbe..0d45ee3 100755 --- a/robotframework-onap/vcpeutils/vcpecommon.py +++ b/robotframework-onap/vcpeutils/vcpecommon.py @@ -7,10 +7,6 @@ import sys import ipaddress import requests -import commands -import time -from novaclient import client as openstackclient -from netaddr import IPAddress, IPNetwork class VcpeCommon: ############################################################################################# @@ -212,7 +208,7 @@ class VcpeCommon: return '_'.join(fields) def set_network_name(self, network_name): - param = ' '.join([k + ' ' + v for k, v in self.cloud.items()]) + param = ' '.join([k + ' ' + v for k, v in list(self.cloud.items())]) openstackcmd = 'openstack ' + param cmd = ' '.join([openstackcmd, 'network set --name', network_name, 'ONAP-NW1']) os.popen(cmd) @@ -223,7 +219,7 @@ class VcpeCommon: set subnet name to vcpe_net_cpe_signal_subnet_201711281221 :return: """ - param = ' '.join([k + ' ' + v for k, v in self.cloud.items()]) + param = ' '.join([k + ' ' + v for k, v in list(self.cloud.items())]) openstackcmd = 'openstack ' + param # expected results: | subnets | subnet_id | @@ -271,10 +267,10 @@ class VcpeCommon: :param sz: a string :return: the first IP address matching the network, e.g. 10.5.12.3 """ - network = ipaddress.ip_network(unicode('{0}/{1}'.format(net_addr, net_addr_len)), strict=False) + network = ipaddress.ip_network(str('{0}/{1}'.format(net_addr, net_addr_len)), strict=False) ip_list = re.findall(r'[0-9]+(?:\.[0-9]+){3}', sz) for ip in ip_list: - this_net = ipaddress.ip_network(unicode('{0}/{1}'.format(ip, net_addr_len)), strict=False) + this_net = ipaddress.ip_network(str('{0}/{1}'.format(ip, net_addr_len)), strict=False) if this_net == network: return str(ip) return None |