# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
+# Authors: Alina Quereilhac <alina.quereilhac@inria.fr>
# Alexandros Kouvakas <alexandros.kouvakas@inria.fr>
+# Julien Tribino <julien.tribino@inria.fr>
from nepi.execution.resource import ResourceManager, clsinit_copy, \
from nepi.resources.linux.application import LinuxApplication
import os
-reschedule_delay = "0.5s"
-
@clsinit_copy
class OVSSwitch(LinuxApplication):
"""
"""
- _rtype = "OVSSwitch"
+ _rtype = "planetlab::OVSSwitch"
_help = "Runs an OpenVSwitch on a PlanetLab host"
- _backend = "planetlab"
+ _platform = "planetlab"
- _authorized_connections = ["PlanetlabNode", "OVSPort", "LinuxNode"]
+ _authorized_connections = ["planetlab::Node", "planetla::OVSPort", "linux::Node"]
@classmethod
def _register_attributes(cls):
"""
bridge_name = Attribute("bridge_name", "Name of the switch/bridge",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
virtual_ip_pref = Attribute("virtual_ip_pref", "Virtual IP/PREFIX of the switch",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
controller_ip = Attribute("controller_ip", "IP of the controller",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
controller_port = Attribute("controller_port", "Port of the controller",
- flags = Flags.ExecReadOnly)
+ flags = Flags.Design)
cls._register_attribute(bridge_name)
cls._register_attribute(virtual_ip_pref)
"""
if not self.node or self.node.state < ResourceState.READY:
- self.ec.schedule(reschedule_delay, self.deploy)
+ self.ec.schedule(self.reschedule_delay, self.deploy)
return
self.do_discover()
"""
from nepi.resources.planetlab.openvswitch.ovsport import OVSPort
- rm = self.get_connected(OVSPort.get_rtype())
+ rms = self.get_connected(OVSPort.get_rtype())
- if rm[0].state < ResourceState.RELEASED:
- self.ec.schedule(reschedule_delay, self.release)
- return
+ for rm in rms :
+ if rm.state < ResourceState.RELEASED:
+ self.ec.schedule(self.reschedule_delay, self.release)
+ return
cmd = "sliver-ovs del-bridge %s" % self.get('bridge_name')
(out, err), proc = self.node.run(cmd, self.ovs_checks,