# Author: Alina Quereilhac <alina.quereilhac@inria.fr>
from nepi.execution.attribute import Attribute, Types, Flags
-from nepi.execution.resource import ResourceManager, clsinit, ResourceState, \
- reschedule_delay
+from nepi.execution.resource import ResourceManager, clsinit_copy, \
+ ResourceState, reschedule_delay, failtrap
from nepi.resources.linux.node import LinuxNode
from nepi.resources.linux.channel import LinuxChannel
# TODO: UP, MTU attributes!
-@clsinit
+@clsinit_copy
class LinuxInterface(ResourceManager):
_rtype = "LinuxInterface"
_help = "Controls network devices on Linux hosts through the ifconfig tool"
if chan: return chan[0]
return None
+ @failtrap
def discover(self):
devname = self.get("deviceName")
ip4 = self.get("ip4")
super(LinuxInterface, self).discover()
+ @failtrap
def provision(self):
devname = self.get("deviceName")
ip4 = self.get("ip4")
super(LinuxInterface, self).provision()
+ @failtrap
def deploy(self):
# Wait until node is provisioned
node = self.node
else:
# Verify if the interface exists in node. If not, configue
# if yes, load existing configuration
- try:
- self.discover()
- self.provision()
- except:
- self.fail()
- raise
+ self.discover()
+ self.provision()
super(LinuxInterface, self).deploy()
def release(self):
- tear_down = self.get("tearDown")
- if tear_down:
- self.execute(tear_down)
+ try:
+ tear_down = self.get("tearDown")
+ if tear_down:
+ self.execute(tear_down)
+ except:
+ import traceback
+ err = traceback.format_exc()
+ self.error(err)
super(LinuxInterface, self).release()