add a global config dictionary
There was no need for each test module to keep a copy for itself. This means we
can also get rid of test_set_init.
diff --git a/tests/cxn.py b/tests/cxn.py
index 7127a91..eeea564 100644
--- a/tests/cxn.py
+++ b/tests/cxn.py
@@ -10,6 +10,7 @@
import unittest
import random
+from oftest import config
import oftest.controller as controller
import oftest.cstruct as ofp
import oftest.message as message
@@ -18,25 +19,6 @@
from oftest.testutils import *
-#@var cxn_port_map Local copy of the configuration map from OF port
-# numbers to OS interfaces
-cxn_port_map = None
-#@var cxn_config Local copy of global configuration data
-cxn_config = None
-
-def test_set_init(config):
- """
- Set up function for connection test classes
-
- @param config The configuration dictionary; see oft
- """
-
- global cxn_port_map
- global cxn_config
-
- cxn_port_map = config["port_map"]
- cxn_config = config
-
class BaseHandshake(unittest.TestCase):
"""
Base handshake case to set up controller, but do not send hello.
@@ -62,10 +44,9 @@
"Controller startup failed, no switch addr")
def setUp(self):
- self.config = cxn_config
logging.info("** START TEST CASE " + str(self))
- self.test_timeout = test_param_get(cxn_config,
+ self.test_timeout = test_param_get(config,
'handshake_timeout') or 60
def inheritSetup(self, parent):
@@ -83,7 +64,6 @@
the state after the sub_test is run must be taken into account
by subsequent operations.
"""
- self.config = parent.config
logging.info("** Setup " + str(self) +
" inheriting from " + str(parent))
self.controller = parent.controller
@@ -109,8 +89,8 @@
and wait for disconnect.
"""
def runTest(self):
- self.controllerSetup(cxn_config["controller_host"],
- cxn_config["controller_port"])
+ self.controllerSetup(config["controller_host"],
+ config["controller_port"])
logging.info("TCP Connected " +
str(self.controller.switch_addr))
@@ -130,8 +110,8 @@
and wait for disconnect.
"""
def runTest(self):
- self.controllerSetup(cxn_config["controller_host"],
- cxn_config["controller_port"])
+ self.controllerSetup(config["controller_host"],
+ config["controller_port"])
logging.info("TCP Connected " +
str(self.controller.switch_addr))
@@ -157,8 +137,8 @@
priority = -1
def runTest(self):
- self.controllerSetup(cxn_config["controller_host"],
- cxn_config["controller_port"])
+ self.controllerSetup(config["controller_host"],
+ config["controller_port"])
logging.info("TCP Connected " +
str(self.controller.switch_addr))