[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/tutorials/artemis/artemis-topo.py b/tools/tutorials/artemis/artemis-topo.py
index a612611..155108d6 100755
--- a/tools/tutorials/artemis/artemis-topo.py
+++ b/tools/tutorials/artemis/artemis-topo.py
@@ -1,5 +1,4 @@
-#!/usr/bin/python
-
+#!/usr/bin/python3
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
@@ -26,7 +25,7 @@
def config(self, **kwargs):
Host.config(self, **kwargs)
- for intf, attrs in self.intfDict.items():
+ for intf, attrs in list(self.intfDict.items()):
self.cmd('ip addr flush dev %s' % intf)
if 'mac' in attrs:
self.cmd('ip link set %s down' % intf)
@@ -49,7 +48,7 @@
Host.config(self, **kwargs)
self.cmd('sysctl net.ipv4.ip_forward=1')
- for intf, attrs in self.intfDict.items():
+ for intf, attrs in list(self.intfDict.items()):
self.cmd('ip addr flush dev %s' % intf)
if 'mac' in attrs:
self.cmd('ip link set %s down' % intf)
@@ -82,7 +81,7 @@
Host.config(self, **kwargs)
self.cmd('sysctl net.ipv4.ip_forward=1')
- for intf, attrs in self.intfDict.items():
+ for intf, attrs in list(self.intfDict.items()):
self.cmd('ip addr flush dev %s' % intf)
if 'mac' in attrs:
self.cmd('ip link set %s down' % intf)
diff --git a/tools/tutorials/sdnip/tutorial.py b/tools/tutorials/sdnip/tutorial.py
index 316690e..7a66e6b 100755
--- a/tools/tutorials/sdnip/tutorial.py
+++ b/tools/tutorials/sdnip/tutorial.py
@@ -1,5 +1,4 @@
-#!/usr/bin/python
-
+#!/usr/bin/python3
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
@@ -36,7 +35,7 @@
Host.config(self, **kwargs)
self.cmd('sysctl net.ipv4.ip_forward=1')
- for intf, attrs in self.intfDict.items():
+ for intf, attrs in list(self.intfDict.items()):
self.cmd('ip addr flush dev %s' % intf)
if 'mac' in attrs:
self.cmd('ip link set %s down' % intf)
diff --git a/tools/tutorials/sdnip/tutorial_ipv6.py b/tools/tutorials/sdnip/tutorial_ipv6.py
index c56579b..30645e8 100755
--- a/tools/tutorials/sdnip/tutorial_ipv6.py
+++ b/tools/tutorials/sdnip/tutorial_ipv6.py
@@ -1,5 +1,4 @@
-#!/usr/bin/python
-
+#!/usr/bin/python3
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
@@ -40,7 +39,7 @@
self.cmd('sysctl net.ipv4.ip_forward=1')
self.cmd('sysctl net.ipv6.conf.all.forwarding=1')
- for intf, attrs in self.intfDict.items():
+ for intf, attrs in list(self.intfDict.items()):
self.cmd('ip addr flush dev %s' % intf)
if 'mac' in attrs:
self.cmd('ip link set %s down' % intf)