Example #1
0
def port_pool_get_example(port_id, pool_id):
    return_data_list = []

    attr_list = {
        'port-id': port_id,
        'buffer-pool-id': pool_id,
    }

    port_pool_obj = nas_qos.PortPoolCPSObj(map_of_attr=attr_list)
    ret = cps.get([port_pool_obj.data()], return_data_list)

    if ret:
        print '#### port pool Profile Show ####'
        for cps_ret_data in return_data_list:
            m = nas_qos.PortPoolCPSObj(cps_data=cps_ret_data)
            m.print_obj()
    else:
        print 'Error in get'
Example #2
0
def port_pool_delete_example(port_id, pool_id):
    attr_list = {
        'port-id': port_id,
        'buffer-pool-id': pool_id,
    }

    port_pool_obj = nas_qos.PortPoolCPSObj(map_of_attr=attr_list)
    upd = ('delete', port_pool_obj.data())
    ret_cps_data = cps_utils.CPSTransaction([upd]).commit()

    if ret_cps_data == False:
        print "port pool delete failed"
    else:
        print "Successfully deleted port pool "
Example #3
0
def port_pool_modify_attrs(port_id, pool_id, mod_attr_list):
    attr_list = {
        'port-id': port_id,
        'buffer-pool-id': pool_id,
    }

    port_pool_obj = nas_qos.PortPoolCPSObj(map_of_attr=attr_list)
    for attr in mod_attr_list:
        port_pool_obj.set_attr(attr[0], attr[1])

    upd = ('set', port_pool_obj.data())
    ret_cps_data = cps_utils.CPSTransaction([upd]).commit()

    if ret_cps_data == False:
        print "port pool modification failed"
    else:
        print "Successfully modified port pool "
Example #4
0
def port_pool_create_example(port_id, pool_id):
    attr_list = {
        'port-id': port_id,
        'buffer-pool-id': pool_id,
    }

    port_pool_obj = nas_qos.PortPoolCPSObj(map_of_attr=attr_list)
    upd = ('create', port_pool_obj.data())
    ret_cps_data = cps_utils.CPSTransaction([upd]).commit()

    if ret_cps_data == False:
        print "port pool creation failed"
        return None

    print 'Return = ', ret_cps_data
    print "Successfully installed port pool on port: %d pool: %d " % (port_id, pool_id)
    return pool_id