From: Lucia Guevgeozian Odizzio Date: Tue, 1 Oct 2013 16:32:52 +0000 (+0200) Subject: Adding omf generic resource manager, and change attributes for omf node X-Git-Tag: nepi-3.0.0~38 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=3027abf982ab3a579c446b888e4a5b56dd7d40a4;p=nepi.git Adding omf generic resource manager, and change attributes for omf node --- diff --git a/src/nepi/resources/omf/node.py b/src/nepi/resources/omf/node.py index 1421078d..b6b65efd 100644 --- a/src/nepi/resources/omf/node.py +++ b/src/nepi/resources/omf/node.py @@ -22,14 +22,14 @@ from nepi.execution.resource import ResourceManager, clsinit, ResourceState, \ reschedule_delay from nepi.execution.attribute import Attribute, Flags - +from nepi.resources.omf.omf_resource import ResourceGateway, OMFResource from nepi.resources.omf.omf_api import OMFAPIFactory import time @clsinit -class OMFNode(ResourceManager): +class OMFNode(OMFResource): """ .. class:: Class Args : @@ -54,38 +54,8 @@ class OMFNode(ResourceManager): """ hostname = Attribute("hostname", "Hostname of the machine") - cpu = Attribute("cpu", "CPU of the node") - ram = Attribute("ram", "RAM of the node") - xmppSlice = Attribute("xmppSlice","Name of the slice", - flags = Flags.Credential) - xmppHost = Attribute("xmppHost", "Xmpp Server", - flags = Flags.Credential) - xmppPort = Attribute("xmppPort", "Xmpp Port", - flags = Flags.Credential) - xmppPassword = Attribute("xmppPassword", "Xmpp Port", - flags = Flags.Credential) - - host = Attribute("host", "Hostname of the machine", - flags = Flags.Filter) - gateway = Attribute("gateway", "Gateway", - flags = Flags.Filter) - granularity = Attribute("granularity", "Granularity of the reservation time", - flags = Flags.Filter) - hardware_type = Attribute("hardware_type", "Hardware type of the machine", - flags = Flags.Filter) cls._register_attribute(hostname) - cls._register_attribute(ram) - cls._register_attribute(cpu) - cls._register_attribute(xmppSlice) - cls._register_attribute(xmppHost) - cls._register_attribute(xmppPort) - cls._register_attribute(xmppPassword) - - cls._register_attribute(host) - cls._register_attribute(gateway) - cls._register_attribute(granularity) - cls._register_attribute(hardware_type) # XXX: We don't necessary need to have the credentials at the # moment we create the RM diff --git a/src/nepi/resources/omf/omf_resource.py b/src/nepi/resources/omf/omf_resource.py new file mode 100644 index 00000000..f6a473a5 --- /dev/null +++ b/src/nepi/resources/omf/omf_resource.py @@ -0,0 +1,63 @@ +# +# NEPI, a framework to manage network experiments +# 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author: Julien Tribino +# Lucia Guevgeozian + +from nepi.execution.attribute import Attribute, Flags, Types +from nepi.execution.resource import ResourceManager, clsinit_copy, ResourceState, \ + reschedule_delay + +class ResourceGateway: + """ + Dictionary used to set OMF gateway depending on Testbed information. + """ + TestbedtoGateway = dict({ + "wilabt" : "ops.wilab2.ilabt.iminds.be", + "nitos" : "??.??.??", + "nicta" : "??.??.??", + }) + +@clsinit_copy +class OMFResource(ResourceManager): + """ + Generic resource gathering XMPP credential information and common methods + for OMF nodes, channels, applications, etc. + """ + _rtype = "OMFResource" + + @classmethod + def _register_attributes(cls): + + xmppSlice = Attribute("xmppSlice","Name of the slice", + flags = Flags.Credential) + xmppHost = Attribute("xmppHost", "Xmpp Server", + flags = Flags.Credential) + xmppPort = Attribute("xmppPort", "Xmpp Port", + flags = Flags.Credential) + xmppPassword = Attribute("xmppPassword", "Xmpp Password", + flags = Flags.Credential) + + cls._register_attribute(xmppSlice) + cls._register_attribute(xmppHost) + cls._register_attribute(xmppPort) + cls._register_attribute(xmppPassword) + + def __init__(self, ec, guid): + super(OMFResource, self).__init__(ec, guid) + pass +