Johan,

 The "tones" application doesn't provide the help text.

/ Srikanth

----- [email protected] wrote:

> python/samples/immoi/samples/README                                |  
> 93 -------
>  python/samples/immoi/samples/interface-handler                     | 
> 121 ---------
>  python/samples/immoi/samples/interface-handler-inheritance-version | 
> 125 ----------
>  python/samples/immoi/samples/classes.xml                           | 
>   0 
>  4 files changed, 0 insertions(+), 339 deletions(-)
> 
> 
> Finish the merge of the previously separate immoi/samples directory
> with the other samples.
> 
> diff --git a/python/samples/immoi/samples/README
> b/python/samples/immoi/samples/README
> deleted file mode 100644
> --- a/python/samples/immoi/samples/README
> +++ /dev/null
> @@ -1,93 +0,0 @@
> -Samples
> -=======
> -
> -The samples use the classes defined in the classes.xml file. Before
> running them, load it:
> -
> -$ immcfg -f classes.xml
> -
> -Each sample OI is implemented in two versions, one using straight
> callbacks and one using a class that subclasses Implementer or
> Applier. The latter is named <oi-name>-inheritance-impl
> -
> -Imm Listener
> -------------
> -
> -The Imm Lister OI demonstrates how to build an applier. It listens to
> changes to SampleClass1 and simply prints them on stdout. It's an
> applier which means that it does not validate any of the changes and
> it can be run in parallel with a proper OI.
> -
> -Use like this:
> -
> -$ imm-listener SampleClass1
> -
> -or, to listen for changes to all configuration classes:
> -
> -$ imm-listener --all
> -
> -
> -Tones
> ------
> -
> -The Tones OI demonstrates validation of containment relations. It
> implements classes for the tones Do, Re, Mi, Fa, So, La, Ti and only
> allows creation of each tone under the lower tone, except for Do which
> can be created without a parent.
> -
> -Use like this:
> -
> -$ tones &
> -
> -$ immcfg -c Do doId=1                 (allowed)
> -
> -$ immcfg -c Re reId=1,doId=1          (allowed)
> -
> -$ immcfg -c Do doId=1,reId=1,doId=1   (not allowed)
> -
> -$ immcfg -c Mi miId=1                 (not allowed)
> -
> -
> -Caps
> -----
> -
> -The Caps OI demonstrates validation. It validates that any new
> CapsSample objects and any updated CapsSample objects follow these
> rules:
> -
> -  - The upperCaps attribute consists only of uppercase characters
> -  - The lowerCaps attribute consists only of lowercase characters
> -
> -Use like this:
> -
> -$ caps &
> -
> -$ immcfg -c CapsSample capsId=<RDN>
> -
> -$ immcfg -a upperCaps=ABC capsId=<RDN>  (allowed)
> -
> -$ immcfg -a lowerCaps=Abc capsId=<RDN>  (not allowed)
> -
> -
> -Time Reporter
> --------------
> -
> -The Time Reporter OI demonstrates update of runtime attributes from
> an OI and inclusion of the OI logic into a select loop owned by the
> application. It creates a runtime object timeId=1 of the class
> TimeSample and updates its hours, minutes and seconds attributes once
> every second.
> -
> -Use like this:
> -
> -$ time-reporter
> -
> -
> -Ping Pong
> ----------
> -
> -The Ping Pong OI demonstrates administrative operations. It creates
> an object pingPongId=1 and responds on admin operations 0 and 1.
> -
> -Use like this:
> -
> -$ ping-pong &
> -
> -$ immadm -o [0|1] pingPongId=1 <parameters..>
> -
> -
> -Users
> ------
> -
> -The Users OI demonstrates an OI that returns values of runtime
> attributes when it's queried by IMM. It uses the Python package psutil
> to fill in the list of logged in users.
> -
> -Use like this:
> -
> -$ users &
> -
> -$ immlist usersId=1
> -
> diff --git a/python/samples/immoi/samples/interface-handler
> b/python/samples/immoi/samples/interface-handler
> deleted file mode 100755
> --- a/python/samples/immoi/samples/interface-handler
> +++ /dev/null
> @@ -1,121 +0,0 @@
> -#!/usr/bin/env python
> -
> -import argparse
> -import sys
> -import netifaces
> -import select
> -
> -from pyosaf.saAis import eSaAisErrorT
> -
> -from pyosaf.utils import immom, immoi
> -
> -from pyosaf.utils.immom.object import ImmObject
> -from pyosaf.utils.immom.iterator import InstanceIterator
> -
> -
> -from pyosaf.utils.immoi import get_object_no_runtime
> -from pyosaf.utils.immoi.implementer import Implementer
> -
> -interface_class_name = "InterfaceRO01"
> -timeout = 1
> -
> -def get_interface_name_from_dn(dn):
> -
> -    return dn.split(',')[0].split('=')[1]
> -
> -def create_rt_object_for_interface(implementer, interface):
> -
> -    mo = ImmObject(class_name=interface_class_name,
> dn='interfaceId=%s' % interface)
> -
> -    # Set the RDN with the right interface name
> -    mo.interfaceId = 'interfaceId=%s' % interface
> -
> -    # Look up the IPv4 and IPv6 addresses
> -    addresses = netifaces.ifaddresses(interface)
> -
> -    mo.ipv4Addresses = None
> -    mo.ipv6Addresses = None
> -
> -    if netifaces.AF_INET in addresses:
> -        ipv4 = [a['addr'] for a in addresses[netifaces.AF_INET]]
> -        mo.ipv4Addresses = ipv4
> -    else:
> -        mo.ipv4Addresses = "dummy"
> -
> -    if netifaces.AF_INET6 in addresses:
> -        ipv6 = [a['addr'] for a in addresses[netifaces.AF_INET6]]
> -        mo.ipv6Addresses = ipv6
> -    else:
> -        mo.ipv6Addresses = "dummy"
> -
> -    ##
> -    ## This exposes a potential fault in IMM.
> -    ##
> -    ## Cached attributes need to have their values set when 
> -    ## the object is created. If there is an interface that lacks
> -    ## an IPv4 or IPv6 address, this will be set to None and 
> -    ## converted to an empty list in the implementer code. IMM
> -    ## does not allow this and responds with
> SA_AIS_ERR_INVALID_PARAM
> -    ##
> -
> -    implementer.create(mo)
> -
> -def select_loop(implementer):
> -
> -    # Get selection object for the implementer
> -    selection_object = implementer.get_selection_object()
> -
> -    # Wait for next IO event or N seconds
> -    inputs  = [selection_object]
> -    outputs = []
> -
> -    while inputs:
> -
> -        readable, writable, exceptional = \
> -        select.select(inputs, outputs, inputs, timeout)
> -
> -        if selection_object in readable:
> -            implementer.dispatch()
> -        else:
> -
> -            interfaces = netifaces.interfaces()
> -
> -            # Add objects for new interfaces
> -            for interface in interfaces:
> -                if not immoi.get_object_no_runtime('interfaceId=%s' %
> interface,
> -                                                  
> class_name=interface_class_name):
> -                    create_rt_object_for_interface(implementer,
> interface)
> -
> -            # Go through existing objects
> -            for mo in InstanceIterator('InterfaceRO'):
> -                interface_name = get_interface_name_from_dn(mo.dn)
> -
> -                # Remove objects for deleted interfaces
> -                if not mo.dn in interfaces:
> -                    implementer.delete(mo.dn)
> -
> -                # Update interfaces
> -                addresses = netifaces.ifaddresses(interface_name)
> -
> -                ipv4 = None
> -                ipv6 = None
> -
> -                if netifaces.AF_INET in addresses:
> -                    ipv4 = [a['addr'] for a in
> addresses[netifaces.AF_INET]]
> -
> -                if netifaces.AF_INET6 in addresses:
> -                    ipv6 = [a['addr'] for a in
> addresses[netifaces.AF_INET6]]
> -
> -                attributes = {'ipv4Addresses' : ipv4,
> -                              'ipv6Addresses' : ipv6}
> -
> -                implementer.update_runtime_attributes(mo.dn,
> attributes)
> -
> -
> -if __name__ == "__main__":
> -
> -    # Create the implementer instance
> -    interface_implementer = Implementer(name="InterfaceImplementer")
> -
> -    # Enter an infinite select loop
> -    select_loop(interface_implementer)
> diff --git
> a/python/samples/immoi/samples/interface-handler-inheritance-version
> b/python/samples/immoi/samples/interface-handler-inheritance-version
> deleted file mode 100755
> ---
> a/python/samples/immoi/samples/interface-handler-inheritance-version
> +++ /dev/null
> @@ -1,125 +0,0 @@
> -#!/usr/bin/env python
> -
> -import argparse
> -import sys
> -import netifaces
> -import select
> -
> -from pyosaf.saAis import eSaAisErrorT
> -
> -from pyosaf.utils import immom, immoi
> -
> -from pyosaf.utils.immom.object import ImmObject
> -from pyosaf.utils.immom.iterator import InstanceIterator
> -
> -
> -from pyosaf.utils.immoi import get_object_no_runtime
> -from pyosaf.utils.immoi.implementer import Implementer
> -
> -interface_class_name = "InterfaceRO01"
> -timeout = 1
> -
> -class InterfaceImplementer(Implementer):
> -    
> -
> -    def __init__(self, timeout=1):
> -        Implementer.__init__(self, name="InterfaceImplementer")
> -
> -        self.timeout = timeout
> -
> -    def get_interface_name_from_dn(self, dn):
> -
> -        return dn.split(',')[0].split('=')[1]
> -
> -    def create_rt_object_for_interface(self, interface):
> -
> -        mo = ImmObject(class_name=interface_class_name,
> dn='interfaceId=%s' % interface)
> -
> -        # Set the RDN with the right interface name
> -        mo.interfaceId = 'interfaceId=%s' % interface
> -
> -        # Look up the IPv4 and IPv6 addresses
> -        addresses = netifaces.ifaddresses(interface)
> -
> -        if netifaces.AF_INET in addresses:
> -            ipv4 = [a['addr'] for a in addresses[netifaces.AF_INET]]
> -            mo.ipv4Addresses = ipv4
> -        else:
> -            mo.ipv4Addresses = "dummy"
> -
> -        if netifaces.AF_INET6 in addresses:
> -            ipv6 = [a['addr'] for a in
> addresses[netifaces.AF_INET6]]
> -            mo.ipv6Addresses = ipv6
> -        else:
> -            mo.ipv6Addresses = "dummy"
> -
> -        ##
> -        ## This exposes a potential fault in IMM.
> -        ##
> -        ## Cached attributes need to have their values set when 
> -        ## the object is created. If there is an interface that
> lacks
> -        ## an IPv4 or IPv6 address, this will be set to None and 
> -        ## converted to an empty list in the implementer code. IMM
> -        ## does not allow this and responds with
> SA_AIS_ERR_INVALID_PARAM
> -        ##
> -        ## Work around this for now by setting dummy values
> -        ##
> -
> -        self.create(mo)
> -
> -    def enter_dispatch_loop(self):
> -
> -        # Wait for next IO event or N seconds
> -        inputs  = [self.get_selection_object()]
> -        outputs = []
> -
> -        while inputs:
> -
> -            readable, writable, exceptional = \
> -            select.select(inputs, outputs, inputs, timeout)
> -
> -            if self.get_selection_object() in readable:
> -                self.dispatch()
> -            else:
> -
> -                interfaces = netifaces.interfaces()
> -
> -                # Add objects for new interfaces
> -                for interface in interfaces:
> -                    if not
> immoi.get_object_no_runtime('interfaceId=%s' % interface,
> -                                                      
> class_name=interface_class_name):
> -                       
> self.create_rt_object_for_interface(interface)
> -
> -                # Go through existing objects
> -                for mo in InstanceIterator('InterfaceRO'):
> -                    interface_name =
> self.get_interface_name_from_dn(mo.dn)
> -
> -                    # Remove objects for deleted interfaces
> -                    if not mo.dn in interfaces:
> -                        self.delete(mo.dn)
> -
> -                    # Update interfaces
> -                    addresses =
> netifaces.ifaddresses(interface_name)
> -
> -                    ipv4 = None
> -                    ipv6 = None
> -
> -                    if netifaces.AF_INET in addresses:
> -                        ipv4 = [a['addr'] for a in
> addresses[netifaces.AF_INET]]
> -
> -                    if netifaces.AF_INET6 in addresses:
> -                        ipv6 = [a['addr'] for a in
> addresses[netifaces.AF_INET6]]
> -
> -                    attributes = {'ipv4Addresses' : ipv4,
> -                                  'ipv6Addresses' : ipv6}
> -
> -                    self.update_runtime_attributes(mo.dn,
> attributes)
> -
> -
> -if __name__ == "__main__":
> -
> -    # Create the implementer
> -    interface_implementer = InterfaceImplementer()
> -
> -    # Enter an infinite select loop
> -    interface_implementer.enter_dispatch_loop()
> diff --git a/python/samples/immoi/samples/classes.xml
> b/python/samples/sample-classes.xml
> rename from python/samples/immoi/samples/classes.xml
> rename to python/samples/sample-classes.xml

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to