[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/create-flow.py b/tools/test/scenarios/bin/create-flow.py
index 9d709a0..a5bf9ba 100755
--- a/tools/test/scenarios/bin/create-flow.py
+++ b/tools/test/scenarios/bin/create-flow.py
@@ -1,5 +1,4 @@
-#! /usr/bin/env python
-
+#! /usr/bin/env python3
import requests
from requests.auth import HTTPBasicAuth
@@ -8,7 +7,7 @@
if len(sys.argv) != 6:
- print "usage: create-flow onos-node name device in-port out-port"
+ print("usage: create-flow onos-node name device in-port out-port")
sys.exit(1)
node = sys.argv[1]
@@ -47,11 +46,11 @@
params=payload)
if flowRequest.status_code != 201:
- print flowRequest.text
+ print(flowRequest.text)
sys.exit(1)
location = flowRequest.headers["location"]
-print "@stc " + name + "Location=" + location
+print("@stc " + name + "Location=" + location)
sys.exit(0)