function mergePoolToLB(lbs, poolsData, callback) {
    logutils.logger.debug('mergePoolToLB');
    if (lbs['loadbalancers'].length > 0 && poolsData.length > 0) {
        for (var lb = 0; lb < lbs['loadbalancers'].length; lb++) {
            var llistener_ref = lbs['loadbalancers'][lb]['loadbalancer']['loadbalancer-listener'];
            if (lbs['loadbalancers'][lb]['loadbalancer'] != null
                    && llistener_ref != null && llistener_ref.length > 0) {
                for (i = 0; i < llistener_ref.length; i++) {
                    var pools = llistener_ref[i]['loadbalancer-pool']
                    if (lbs['loadbalancers'][lb]['loadbalancer'] != null
                            && pools != null && pools.length > 0) {
                        for (k = 0; k < pools.length; k++) {
                            for (var l = 0; l < poolsData.length; l++) {
                                if (pools[k]['uuid'] == poolsData[l]['loadbalancer-pool']['uuid']) {
                                    pools[k] = poolsData[l]['loadbalancer-pool'];
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    var jsonstr = JSON.stringify(lbs);
    var new_jsonstr = jsonstr.replace(/loadbalancer_healthmonitor_refs/g,
            'loadbalancer-healthmonitor');
    var new_jsonstr1 = new_jsonstr.replace(/loadbalancer_members/g,
            'loadbalancer-members');
    lbs = JSON.parse(new_jsonstr1);
    callback(lbs);
}
/**
 * @mergePoolToLB
 * @private function Return call back it process loadbalancer-pool details merge
 *          it to loadbalancer-listener.
 * @param lbs
 * @param pools
 * @param callback
 * @returns
 */
@mergePoolToLB
@private function Return call back it process loadbalancer-pool details merge
it to loadbalancer-listener.
@mergePoolToLB @private function Return call back it process loadbalancer - pool details merge it to loadbalancer - listener .
function mergePoolToLB(lbs, poolsData, callback) {
    logutils.logger.debug('mergePoolToLB');
    if (lbs['loadbalancers'].length > 0 && poolsData.length > 0) {
        for (var lb = 0; lb < lbs['loadbalancers'].length; lb++) {
            var llistener_ref = lbs['loadbalancers'][lb]['loadbalancer']['loadbalancer-listener'];
            if (lbs['loadbalancers'][lb]['loadbalancer'] != null
                    && llistener_ref != null && llistener_ref.length > 0) {
                for (i = 0; i < llistener_ref.length; i++) {
                    var pools = llistener_ref[i]['loadbalancer-pool']
                    if (lbs['loadbalancers'][lb]['loadbalancer'] != null
                            && pools != null && pools.length > 0) {
                        for (k = 0; k < pools.length; k++) {
                            for (var l = 0; l < poolsData.length; l++) {
                                if (pools[k]['uuid'] == poolsData[l]['loadbalancer-pool']['uuid']) {
                                    pools[k] = poolsData[l]['loadbalancer-pool'];
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    var jsonstr = JSON.stringify(lbs);
    var new_jsonstr = jsonstr.replace(/loadbalancer_healthmonitor_refs/g,
            'loadbalancer-healthmonitor');
    var new_jsonstr1 = new_jsonstr.replace(/loadbalancer_members/g,
            'loadbalancer-members');
    lbs = JSON.parse(new_jsonstr1);
    callback(lbs);
}
function mergePoolToLB ( lbs , poolsData , callback ) { logutils . logger . debug ( 'mergePoolToLB' ) ; if ( lbs [ 'loadbalancers' ] . length > 0 && poolsData . length > 0 ) { for ( var lb = 0 ; lb < lbs [ 'loadbalancers' ] . length ; lb ++ ) { var llistener_ref = lbs [ 'loadbalancers' ] [ lb ] [ 'loadbalancer' ] [ 'loadbalancer-listener' ] ; if ( lbs [ 'loadbalancers' ] [ lb ] [ 'loadbalancer' ] != null && llistener_ref != null && llistener_ref . length > 0 ) { for ( i = 0 ; i < llistener_ref . length ; i ++ ) { var pools = llistener_ref [ i ] [ 'loadbalancer-pool' ] if ( lbs [ 'loadbalancers' ] [ lb ] [ 'loadbalancer' ] != null && pools != null && pools . length > 0 ) { for ( k = 0 ; k < pools . length ; k ++ ) { for ( var l = 0 ; l < poolsData . length ; l ++ ) { if ( pools [ k ] [ 'uuid' ] == poolsData [ l ] [ 'loadbalancer-pool' ] [ 'uuid' ] ) { pools [ k ] = poolsData [ l ] [ 'loadbalancer-pool' ] ; } } } } } } } } var jsonstr = JSON . stringify ( lbs ) ; var new_jsonstr = jsonstr . replace ( / loadbalancer_healthmonitor_refs / g , 'loadbalancer-healthmonitor' ) ; var new_jsonstr1 = new_jsonstr . replace ( / loadbalancer_members / g , 'loadbalancer-members' ) ; lbs = JSON . parse ( new_jsonstr1 ) ; callback ( lbs ) ; }
@mergePoolToLB
 @private function Return call back it process loadbalancer-pool details merge
          it to loadbalancer-listener.
@mergePoolToLB @private function Return call back it process loadbalancer - pool details merge it to loadbalancer - listener .