# Copyright (C) 2013 INRIA
#
# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
from nepi.execution.attribute import Attribute, Types, Flags
from nepi.execution.resource import ResourceManager, clsinit_copy, \
- ResourceState, reschedule_delay
+ ResourceState
from nepi.resources.linux.node import LinuxNode
from nepi.resources.linux.channel import LinuxChannel
@clsinit_copy
class LinuxInterface(ResourceManager):
- _rtype = "LinuxInterface"
+ _rtype = "linux::Interface"
_help = "Controls network devices on Linux hosts through the ifconfig tool"
- _backend = "linux"
+ _platform = "linux"
@classmethod
def _register_attributes(cls):
if err and proc.poll():
msg = " Error retrieving interface information "
self.error(msg, out, err)
- raise RuntimeError, "%s - %s - %s" % (msg, out, err)
+ raise RuntimeError("%s - %s - %s" % (msg, out, err))
# Check if an interface is found matching the RM attributes
ifaces = out.split("\n\n")
if not self.get("deviceName"):
msg = "Unable to resolve interface "
self.error(msg)
- raise RuntimeError, msg
+ raise RuntimeError(msg)
super(LinuxInterface, self).do_discover()
if err and proc.poll():
msg = "Error configuring interface with command '%s'" % cmd
self.error(msg, out, err)
- raise RuntimeError, "%s - %s - %s" % (msg, out, err)
+ raise RuntimeError("%s - %s - %s" % (msg, out, err))
if ip6 and mask6:
cmd = "ifconfig %(devname)s inet6 add %(ip6)s/%(mask6)d" % ({
if err and proc.poll():
msg = "Error seting ipv6 for interface using command '%s' " % cmd
self.error(msg, out, err)
- raise RuntimeError, "%s - %s - %s" % (msg, out, err)
+ raise RuntimeError("%s - %s - %s" % (msg, out, err))
super(LinuxInterface, self).do_provision()
chan = self.channel
if not node or node.state < ResourceState.PROVISIONED:
- self.ec.schedule(reschedule_delay, self.deploy)
+ self.ec.schedule(self.reschedule_delay, self.deploy)
elif not chan or chan.state < ResourceState.READY:
- self.ec.schedule(reschedule_delay, self.deploy)
+ self.ec.schedule(self.reschedule_delay, self.deploy)
else:
# Verify if the interface exists in node. If not, configue
# if yes, load existing configuration