Summary: pyosaf: [Updated] Fix Ccb and ImmObject classes to handle more inputs 
[#1663]
Review request for Trac Ticket(s): #1663
Peer Reviewer(s): hans.nordeb...@ericsson.com, mathi.naic...@oracle.com, 
hung.d.ngu...@dektech.com.au, srikanth.revan...@oracle.com
Pull request to: srikanth.revan...@oracle.com
Affected branch(es): 4.7
Development branch: opensaf-devel

--------------------------------
Impacted area       Impact y/n
--------------------------------
 Docs                    n
 Build system            n
 RPM/packaging           n
 Configuration files     n
 Startup scripts         n
 SAF services            n
 OpenSAF services        n
 Core libraries          n
 Samples                 n
 Tests                   n
 Other                   y


Comments (indicate scope for each "y" above):
---------------------------------------------
Updated according to Hung's review comment.

changeset a0ab6b0ed67707b972a2091095d7a704c1ac8f6f
Author: Johan Mårtensson <johan.o.martens...@ericsson.com>
Date:   Mon, 18 Jan 2016 09:41:05 +0100

        pyosaf: Fix Ccb and ImmObject classes to handle more inputs [#1663]

        Fix the Ccb class to allow entering values as atoms in modify operations
        when there is only a single value affected.

        Fix ImmObject to automatically prepend <rdn-attribute-name>= to the RDN
        attribute value to make it adhere to the format expected by IMM, if the 
user
        only provided the actual value.


Complete diffstat:
------------------
 python/pyosaf/utils/immom/ccb.py    |  12 ++++++++++++
 python/pyosaf/utils/immom/object.py |   5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)


Testing Commands:
-----------------
1. Load the sample classes: immcfg -f python/samples/sample-classes.xml
2. Create an initial sample instance: immcfg -c SampleClass1 sampleClassId=1
3. Run the following python test program:

#!/usr/bin/env python

from pyosaf.utils.immom.ccb import Ccb
from pyosaf.utils import immom
from pyosaf.utils.immom.object import ImmObject

# Test current behavior
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', ['abc'])

ccb.apply()

print '%s == %s' % ('abc', immom.get('sampleClassId=1').attribute1)

# Test common mistake
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', 'abcd')

ccb.apply()

print '%s == %s' % ('abcd', immom.get('sampleClassId=1').attribute1)




# Test current behavior
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', [])
ccb.modify_value_add('sampleClassId=1', 'attribute1', ['def'])

ccb.apply()

print '%s in %s' % ('def', immom.get('sampleClassId=1').attribute1)

# Test common mistake
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', [])
ccb.modify_value_add('sampleClassId=1', 'attribute1', 'defg')

ccb.apply()

print '%s in %s' % ('defg', immom.get('sampleClassId=1').attribute1)




# Test current behavior
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', 'def')
ccb.modify_value_delete('sampleClassId=1', 'attribute1', ['def'])

ccb.apply()

print '%s not in %s' % ('def', immom.get('sampleClassId=1').attribute1)

# Test common mistake
ccb = Ccb(flags=None)

ccb.modify_value_replace('sampleClassId=1', 'attribute1', 'defg')
ccb.modify_value_delete('sampleClassId=1', 'attribute1', 'defg')

ccb.apply()

print '%s not in %s' % ('defg', immom.get('sampleClassId=1').attribute1)



# Create Imm object old style
obj = ImmObject(class_name='SampleClass1')

obj.sampleClassId = 'sampleClassId=2'

ccb = Ccb(flags=None)
ccb.create(obj)
ccb.apply()

print 'Object exists, sampleClassId=2: %s' % immom.get('sampleClassId=2').dn

# Create Imm object new style
obj2 = ImmObject(class_name='SampleClass1')

obj2.sampleClassId = '33'

ccb = Ccb(flags=None)
ccb.create(obj2)
ccb.apply()

print 'Object exists, sampleClassId=33: %s' % immom.get('sampleClassId=33').dn



Testing, Expected Results:
--------------------------
 <<PASTE COMMAND OUTPUTS / TEST RESULTS>>


Conditions of Submission:
-------------------------
 <<HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC>>


Arch      Built     Started    Linux distro
-------------------------------------------
mips        n          n
mips64      n          n
x86         n          n
x86_64      n          n
powerpc     n          n
powerpc64   n          n


Reviewer Checklist:
-------------------
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
    that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
    (i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
    Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
    like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
    cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
    too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
    Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
    commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
    of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
    comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
    the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
    for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
    do not contain the patch that updates the Doxygen manual.


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to