use a single dataplane instance for all tests
Creating and destroying dataplane instances was taking about 1/3 of the total
runtime.
diff --git a/src/python/oftest/base_tests.py b/src/python/oftest/base_tests.py
index db9e4a9..38621af 100644
--- a/src/python/oftest/base_tests.py
+++ b/src/python/oftest/base_tests.py
@@ -8,6 +8,7 @@
import logging
import unittest
+import oftest
from oftest import config
import oftest.controller as controller
import oftest.cstruct as ofp
@@ -95,9 +96,8 @@
"""
def setUp(self):
SimpleProtocol.setUp(self)
- self.dataplane = dataplane.DataPlane(config)
- for of_port, ifname in config["port_map"].items():
- self.dataplane.port_add(ifname, of_port)
+ self.dataplane = oftest.dataplane_instance
+ self.dataplane.flush()
def inheritSetup(self, parent):
"""
@@ -111,9 +111,6 @@
def tearDown(self):
logging.info("Teardown for simple dataplane test")
SimpleProtocol.tearDown(self)
- if hasattr(self, 'dataplane'):
- self.dataplane.kill()
- del self.dataplane
logging.info("Teardown done")
def runTest(self):
@@ -130,14 +127,11 @@
def setUp(self):
self.clean_shutdown = True
logging.info("** START DataPlaneOnly CASE " + str(self))
- self.dataplane = dataplane.DataPlane(config)
- for of_port, ifname in config["port_map"].items():
- self.dataplane.port_add(ifname, of_port)
+ self.dataplane = oftest.dataplane_instance
+ self.dataplane.flush()
def tearDown(self):
logging.info("Teardown for simple dataplane test")
- self.dataplane.kill()
- del self.dataplane
logging.info("Teardown done")
def runTest(self):