예제 #1
0
 def load_class_details(self):
     libs = []
     path = os.getenv("LD_LIBRARY_PATH")
     if path is None:
         path = '/opt/dell/os10/lib'
     for i in path.split(':'):
         print "Searching " + i
         files = os.listdir(i)
         for f in files:
             if f.find('cpsclass') == -1:
                 continue
             libs.append(i)
             break
     for i in libs:
         print "Loading from " + i
         res = cps.init(i, 'cpsclass')
         print res
 def load_class_details(self):
     libs = []
     path = os.getenv("LD_LIBRARY_PATH")
     if path is None:
         path = '/opt/dell/os10/lib'
     for i in path.split(':'):
         print "Searching " + i
         files = os.listdir(i)
         for f in files:
             if f.find('cpsclass') == -1:
                 continue
             libs.append(i)
             break
     for i in libs:
         print "Loading from " + i
         res = cps.init(i, 'cpsclass')
         print res
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
#  LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS
# FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#

import cps
import sys
import os

if __name__ == '__main__':
    # load the mapping file
    cps.init(
        '/localdisk/cwichmann/cps-api/workspace/debian/jessie/x86_64/sysroot/opt/dell/os10/lib/',
        'libcpsclass-')

    data = cps.info('19')
    print data
    data = cps.info('20')
    print data
    print cps.convdict({'1': 'dasra'})
    # Get the cps objects
    result = cps.get(['1.2.3.4'])

    # print discovered map
    print result
    # walk through the map and print the contents
    for d in result.keys():
        print d