summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test/route_server_test2.py
diff options
context:
space:
mode:
authorFranza Cavalcante <franza.cavalcante@bestateless.com>2019-06-20 16:46:18 -0600
committerFUJITA Tomonori <fujita.tomonori@gmail.com>2019-06-22 19:53:11 +0900
commit8c90684b276d994d09b3dc0d5a030900bbb39929 (patch)
tree4fd885a311aaf800fcf7527ec06f9effd072fedb /test/scenario_test/route_server_test2.py
parent7c2f0967afba5e91e0ad1c76e9f71c4f578d5844 (diff)
Python3 support to gobgp tests
This PR removes dependencies on old Fabric version, as it's not supported by Python3. The current Fabric versions don't support the colors and indent used previously, so we found substitute methods from other libraries and defined these in the library files. The local function from fabric is now just a wrapper to invoke's run function. All the files were processed through 2to3 command. All the tests were executed and we don't see any difference on the outputs when running Python2 or Python3. The creation of gobgp container is removed from base.py into fabfile.py, in order to comply with Fabric2 changes and simplify dependencies.
Diffstat (limited to 'test/scenario_test/route_server_test2.py')
-rw-r--r--test/scenario_test/route_server_test2.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/scenario_test/route_server_test2.py b/test/scenario_test/route_server_test2.py
index 08b984ae..e070bc0b 100644
--- a/test/scenario_test/route_server_test2.py
+++ b/test/scenario_test/route_server_test2.py
@@ -13,19 +13,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from __future__ import absolute_import
+
import sys
import time
import unittest
-from fabric.api import local
import nose
from lib.noseplugin import OptionParser, parser_option
from lib import base
-from lib.base import BGP_FSM_ESTABLISHED
+from lib.base import BGP_FSM_ESTABLISHED, local
from lib.gobgp import GoBGPContainer
from lib.exabgp import ExaBGPContainer
@@ -53,7 +52,7 @@ class GoBGPTestBase(unittest.TestCase):
initial_wait_time = max(ctn.run() for ctn in ctns)
time.sleep(initial_wait_time)
- for cli in cls.clients.values():
+ for cli in list(cls.clients.values()):
# Omit "passwd" to avoid a issue on ExaBGP version 4.0.5:
# https://github.com/Exa-Networks/exabgp/issues/766
g1.add_peer(cli, is_rs_client=True, passive=True, prefix_limit=10)
@@ -67,7 +66,7 @@ class GoBGPTestBase(unittest.TestCase):
# test each neighbor state is turned establish
def test_01_neighbor_established(self):
- for cli in self.clients.values():
+ for cli in list(self.clients.values()):
self.gobgp.wait_for(expected_state=BGP_FSM_ESTABLISHED, peer=cli)
def test_02_add_neighbor(self):
@@ -103,7 +102,7 @@ class GoBGPTestBase(unittest.TestCase):
if __name__ == '__main__':
output = local("which docker 2>&1 > /dev/null ; echo $?", capture=True)
if int(output) is not 0:
- print "docker not found"
+ print("docker not found")
sys.exit(1)
nose.main(argv=sys.argv, addplugins=[OptionParser()],