Move the inst.Monitoring... line to the bottom under inst = self or use self.Monitoring = ...

inst is still of type None when you try to assign inst.Monitoring. It says inst is of type NoneType and does not have an attribute Monitoring. So either you assign self to inst first or you assing your monitoring component to self.Monitoring and then assign inst.

Best regards
Bernd

On 28.02.2012 15:51, Baraki Halefom wrote:

The following is what I did and is same as what is in pyswitch. but still gives the same error

def __init__(self, ctxt):
        global inst
        Component.__init__(self, ctxt)
        self.ctxt = ctxt
inst.Monitoring = ctxt.resolve("nox.netapps.monitoring.monitoring.Monit$
self.st <http://self.st> = {}

        inst = self


On Tue, Feb 28, 2012 at 9:25 AM, Bernd Wittefeld <s9bew...@stud.uni-saarland.de <mailto:s9bew...@stud.uni-saarland.de>> wrote:

    Hi,
    it complains about "inst" not being declared (it is of type None).
    You missed the

    "inst = self"

    in the __init__ method of your component. Maybe you should take a
    look at the pyswitch.py from coreapps/examples.

    Best regards
    Bernd


    On 28.02.2012 14:59, Baraki Halefom wrote:
    Thank you for your reply. but I got same same error     "
    AttributeError: 'NoneType' object has no attribute 'Monitoring'  "
    after making the changes you told me.

    inst.Monitoring =
    ctxt.resolve("nox.netapps.monitoring.monitoring.Monitoring")

    and run monitoring in the commandline

    Sincerely,


    On Tue, Feb 28, 2012 at 7:28 AM, Bernd Wittefeld
    <s9bew...@stud.uni-saarland.de
    <mailto:s9bew...@stud.uni-saarland.de>> wrote:

        Hi,
        the resolve() function expects a string. You don't even need
        to import the monitoring stuff.

        inst.Monitoring =
        ctxt.resolve("nox.netapps.monitoring.monitoring.Monitoring")

        Of course you should ensure that the Monitoring module is
        resolvable, that means, it must be loaded by NOX either by
        issueing it on the commandline or (which is the cleaner way)
        it must be declared in the meta.json file of your component
        as a dependency.

        Hope that helps.

        Best regards,
        Bernd



        On 27.02.2012 17 <tel:27.02.2012%2017>:53, Baraki Halefom wrote:

        Hello everyone,

        I want use the methods in the Monitoring component to send
        flow stats request from my own component.
        I did the following two variations to user the monitoring
        component

             1.  include monitoring component in the dependency list
        of my components meta.json file

                 import the monitoring component as: from
        nox.netapps.monitoring.monitoring import Monitoring

                then inside my component :

                  def __init_(self, ctxt):
                      global inst
                      Component.__init__(self,ctxt)
                      inst.Monitoring = ctxt.resolve(Monitoring)

        and then use it like,  inst.Monitoring.send_flow_
        stats_request(....)

         this gives me Monitoring description not found error.

        2. when I tried to use the monitoring component in the
        command line after the proper import as follows

        > ./nox_core -i ptcp:6633 monitoring mycomponent

        it gives me again the following error.
                    inst.Monitoring = ctxt.resolve(Monitoring)
                    AttributeError: 'NoneType' object has not
        attribute 'Monitoring'

        please tell me where my mistake is.

        thanks

--

        Baraki H. Abay
        Department of Math and Computer science
        North Carolina Central University
        Durham, 27707 NC



        _______________________________________________
        nox-dev mailing list
        nox-dev@noxrepo.org  <mailto:nox-dev@noxrepo.org>
        http://noxrepo.org/mailman/listinfo/nox-dev




--

    Baraki H. Abay
    Department of Math and Computer science
    North Carolina Central University
    Durham, 27707 NC





--


Baraki H. Abay
Department of Math and Computer science
North Carolina Central University
Durham, 27707 NC


_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to