[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-intent.py b/tools/test/scenarios/bin/create-intent.py
index 4e5d4f6..aeb2492 100755
--- a/tools/test/scenarios/bin/create-intent.py
+++ b/tools/test/scenarios/bin/create-intent.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) != 7:
- print "usage: create-intent onos-node name ingressDevice ingressPort egressDevice egressPort"
+ print("usage: create-intent onos-node name ingressDevice ingressPort egressDevice egressPort")
sys.exit(1)
node = sys.argv[1]
@@ -38,11 +37,11 @@
data=intentJson)
if intentRequest.status_code != 201:
- print intentRequest.text
+ print(intentRequest.text)
sys.exit(1)
location = intentRequest.headers["location"]
-print "@stc " + name + "Location=" + location
+print("@stc " + name + "Location=" + location)
sys.exit(0)