summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ovs/ofctl.py15
-rw-r--r--vswitches/ovs.py4
2 files changed, 4 insertions, 15 deletions
diff --git a/src/ovs/ofctl.py b/src/ovs/ofctl.py
index b023e080..21da850a 100644
--- a/src/ovs/ofctl.py
+++ b/src/ovs/ofctl.py
@@ -156,21 +156,6 @@ class OFBridge(OFBase):
self._ports = {}
self._cache_file = None
- # context manager
-
- def __enter__(self):
- """Create datapath
-
- :returns: self
- """
- return self
-
- def __exit__(self, type_, value, traceback):
- """Remove datapath.
- """
- if not traceback:
- self.destroy()
-
# helpers
def run_ofctl(self, args, check_error=False, timeout=None):
diff --git a/vswitches/ovs.py b/vswitches/ovs.py
index 9e49b2ee..6f650005 100644
--- a/vswitches/ovs.py
+++ b/vswitches/ovs.py
@@ -128,6 +128,8 @@ class IVSwitchOvs(IVSwitch, tasks.Process):
def stop(self):
"""See IVswitch for general description
"""
+ for switch_name in list(self._bridges):
+ self.del_switch(switch_name)
self._logger.info("Terminating vswitchd...")
self.kill()
self._bridges = {}
@@ -147,6 +149,8 @@ class IVSwitchOvs(IVSwitch, tasks.Process):
"""See IVswitch for general description
"""
bridge = self._bridges[switch_name]
+ for port in list(bridge.get_ports()):
+ bridge.del_port(port)
self._bridges.pop(switch_name)
bridge.destroy()