[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/execute-tapi-context-get-call.py b/tools/test/scenarios/bin/execute-tapi-context-get-call.py
index 22b1f27..7ddee28 100755
--- a/tools/test/scenarios/bin/execute-tapi-context-get-call.py
+++ b/tools/test/scenarios/bin/execute-tapi-context-get-call.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
import requests
import sys
@@ -7,14 +7,14 @@
from requests.auth import HTTPBasicAuth
if len(sys.argv) < 3:
- print "usage: execute-tapi-context-get-call onos-node state"
+ print("usage: execute-tapi-context-get-call onos-node state")
sys.exit(1)
node = sys.argv[1]
state = sys.argv[2] #if empty tapi context must be empty, if full it needs to contain all devices and ports
if state != "empty" and len(sys.argv) == 3:
- print "usage: execute-tapi-context-get-call onos-node full devices links ports"
+ print("usage: execute-tapi-context-get-call onos-node full devices links ports")
sys.exit(1)
request = 'http://' + node + ':8181/onos/restconf/data/tapi-common:context'
@@ -23,9 +23,9 @@
if state == "empty":
uuid = tapiContext['tapi-common:context']['tapi-topology:topology-context']['topology'][0]['uuid']
if uuid == "":
- print "empty uuid"
+ print("empty uuid")
sys.exit(1)
- print "@stc tapi topology uuid=" + uuid
+ print("@stc tapi topology uuid=" + uuid)
sys.exit(0)
if state == "full":
@@ -37,11 +37,11 @@
port_num = 0
for x in range(dev_num):
port_num=port_num+len(tapiContext['tapi-common:context']['tapi-topology:topology-context']['topology'][0]['node'][x]['owned-node-edge-point'])
- print "device\tlink\tport\n%i\t%i\t%i" % (dev_num, directed_link_num/2, port_num)
+ print("device\tlink\tport\n%i\t%i\t%i" % (dev_num, directed_link_num/2, port_num))
assert devices == dev_num
assert links == directed_link_num/2
assert ports == port_num
- print "Topology infomation checking passed."
+ print("Topology infomation checking passed.")
sys.exit(0)
sys.exit(1)