[WIP] ONOS-8091 Port python script and utilities to python3
Steps performed so far:
- Updated bash scripts and similar to explicitly invoke python3 (instead of python)
- Updated all python scripts using 2to3
Testing these changes will be a major headache because:
- different scripts are executed in different environments
(e.g., Jenkins, cell servers, tutorial VMs, etc.)
- we don’t have control on all environments
- some environments we used to control have been dismissed
(e.g., cell servers)
The approach for now is to focus on the essentials:
- Jenkins jobs for pre-merge and release
Test and fix everything else as the need arises.
Change-Id: I943e214760c9dea9a7ded0d47ef08adbc0ed0bec
diff --git a/tools/test/scenarios/bin/check-dhcp-netcfg.py b/tools/test/scenarios/bin/check-dhcp-netcfg.py
index c828c84..2786785 100755
--- a/tools/test/scenarios/bin/check-dhcp-netcfg.py
+++ b/tools/test/scenarios/bin/check-dhcp-netcfg.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
import requests
import sys
@@ -6,7 +6,7 @@
from requests.auth import HTTPBasicAuth
if len(sys.argv) < 3:
- print "usage: find-dhcp-netcfg onos-node name1=value1 ..."
+ print("usage: find-dhcp-netcfg onos-node name1=value1 ...")
sys.exit(1)
node = sys.argv[1]
@@ -15,7 +15,7 @@
':8181/onos/v1/network/configuration/apps/org.onosproject.dhcp',
auth=HTTPBasicAuth('onos', 'rocks'))
-print cfgRequest.text
+print(cfgRequest.text)
if cfgRequest.status_code != 200:
sys.exit(1)
@@ -32,8 +32,8 @@
value = pair[1]
if dhcp[name] != value:
- print name + " differs: expected " + value + " but found " + dhcp[name]
- print cfgJson
+ print(name + " differs: expected " + value + " but found " + dhcp[name])
+ print(cfgJson)
sys.exit(1)