def buffer_pool_get_example(buffer_pool_id): return_data_list = [] buffer_pool_obj = nas_qos.BufferPoolCPSObj(buffer_pool_id=buffer_pool_id) ret = cps.get([buffer_pool_obj.data()], return_data_list) if ret: print '#### buffer pool Profile Show ####' for cps_ret_data in return_data_list: m = nas_qos.BufferPoolCPSObj(cps_data=cps_ret_data) m.print_obj() else: print 'Error in get'
def buffer_pool_modify_attrs(buffer_pool_id, mod_attr_list): buffer_pool_obj = nas_qos.BufferPoolCPSObj(buffer_pool_id=buffer_pool_id) for attr in mod_attr_list: buffer_pool_obj.set_attr(attr[0], attr[1]) upd = ('set', buffer_pool_obj.data()) ret_cps_data = cps_utils.CPSTransaction([upd]).commit() if ret_cps_data == False: print "buffer pool modification failed" return None print 'Return = ', ret_cps_data buffer_pool_obj = nas_qos.BufferPoolCPSObj(cps_data=ret_cps_data[0]) buffer_pool_id = buffer_pool_obj.extract_attr('id') print "Successfully modified buffer pool id = ", buffer_pool_id return buffer_pool_id
def buffer_pool_delete_example(buffer_pool_id): buffer_pool_obj = nas_qos.BufferPoolCPSObj(buffer_pool_id=buffer_pool_id) upd = ('delete', buffer_pool_obj.data()) ret_cps_data = cps_utils.CPSTransaction([upd]).commit() if ret_cps_data == False: print "buffer pool delete failed" return None print 'Return = ', ret_cps_data print "Successfully deleted buffer pool id = ", buffer_pool_id
def init_default_buffer_pool(pool_type, size): attr_list = { 'pool-type': pool_type, 'size': size, 'threshold-mode': 'STATIC', } buffer_pool_obj = nas_qos.BufferPoolCPSObj(map_of_attr=attr_list) upd = ('create', buffer_pool_obj.data()) ret_cps_data = cps_utils.CPSTransaction([upd]).commit() if ret_cps_data == False: syslog.syslog("buffer pool creation failed") return None dbg_print('Return = ', ret_cps_data) buffer_pool_obj = nas_qos.BufferPoolCPSObj(cps_data=ret_cps_data[0]) buffer_pool_id = buffer_pool_obj.extract_attr('id') dbg_print("Successfully installed buffer pool id = ", buffer_pool_id) return buffer_pool_id
def buffer_pool_create_example(pool_type): attr_list = { 'pool-type': pool_type, 'size': 20000, 'threshold-mode': 'STATIC', } buffer_pool_obj = nas_qos.BufferPoolCPSObj(map_of_attr=attr_list) upd = ('create', buffer_pool_obj.data()) ret_cps_data = cps_utils.CPSTransaction([upd]).commit() if ret_cps_data == False: print "buffer pool creation failed" return None print 'Return = ', ret_cps_data buffer_pool_obj = nas_qos.BufferPoolCPSObj(cps_data=ret_cps_data[0]) buffer_pool_id = buffer_pool_obj.extract_attr('id') print "Successfully installed buffer pool id = ", buffer_pool_id return buffer_pool_id