Commit c59cd9d1 authored by Martín Ferrari's avatar Martín Ferrari

Switch: Initialize attributes before doing anything that can fail

parent 39a92658
......@@ -333,11 +333,14 @@ class Switch(ExternalInterface):
"""Creates a new Switch object, which models a linux bridge device.
Parameters are passed to the set_parameters() method after
creation."""
# attributes init
self._idx = None
self._parameters = {}
self._ports = weakref.WeakValueDictionary()
iface = netns.iproute.create_bridge(self._gen_br_name())
super(Switch, self).__init__(iface.index)
self._parameters = {}
self._ports = weakref.WeakValueDictionary()
# FIXME: is this correct/desirable/etc?
self.stp = False
self.forward_delay = 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment