<commit_before>#!/usr/bin/env bash

####################################### GLOBALS ###########################################

SHARED_PLAN="af308299-102f-47a3-acb0-7de72be192bf"
SHARED_POOL_NAME="Shared"
LARGE_PLAN="9bd51219-9cee-4570-99ab-ebe80d82c854"
LARGE_POOL_NAME="Large"
MEDIUM_HA_PLAN="9f57fa1c-7bb1-4a48-a651-d0c560fb5730"
MEDIUM_HA_POOL_NAME="Medium-HA"
LARGE_HA_PLAN="6a833e3f-3a24-419d-94d9-4bb38dc51f04"
LARGE_HA_POOL_NAME="Large-HA"

export SOLACE_SERVICE_NAME="solace-pubsub"

export PAIRS_PARAM="includeMonitor=false"
export MONITOR_PARAM="includeBackup=false&includePrimary=false"
export PRIMARY_PARAM="includeMonitor=false&includeBackup=false"
export BACKUP_PARAM="includeMonitor=false&includePrimary=false"

export SB_ORG=${SB_ORG:-"solace"}
export SB_SPACE=${SB_SPACE:-"solace-broker"}

export TEST_ORG=${TEST_ORG:-"solace-test"}
export TEST_SPACE=${TEST_SPACE:-"test"}

export SYSTEM_DOMAIN=${SYSTEM_DOMAIN:-"bosh-lite.com"}
export CF_ADMIN_PASSWORD=${CF_ADMIN_PASSWORD:-"<PASSWORD>"}
export UAA_ADMIN_CLIENT_SECRET=${UAA_ADMIN_CLIENT_SECRET:-"admin-client-secret"}

export JAVA_BUILD_PACK_VERSION=${JAVA_BUILD_PACK_VERSION:-"3.13"}

####################################### FUNCTIONS ###########################################

function log() {
 echo ""
 echo `date` $1
}


function confirmServiceBrokerRunning() {

    getServiceBrokerDetails

    ## Lookup again to confirm and use for message
    SB_RUNNING=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep started | wc -l`
    if [ "$SB_RUNNING" -eq "1" ]; then
      log "confirmServiceBrokerRunning : Service Broker is running"
    else
      log "confirmServiceBrokerRunning : Service Broker is NOT running"
    fi
    ## Will cause an exit in testing ( set -e )
    cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | grep started
    export SB_APP=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | grep started | awk '{ print $1}'`
}

function getServiceBrokerDetails() {
 
 switchToServiceBrokerTarget

 SB_FOUND=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | wc -l`
 SB_RUNNING=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep started | wc -l`

 if [ "$SB_FOUND" -eq "1" ]; then
  ## Capture a few details from the service broker
   export SB_APP=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | awk '{ print $1}'`
   export SB_URL=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep $SB_APP | awk '{ print $6}'`
   export SECURITY_USER_NAME=`cf env $SB_APP | grep SECURITY_USER_NAME | awk '{ print $2}'`
   export SECURITY_USER_PASSWORD=`cf env $SB_APP | grep SECURITY_USER_PASSWORD | awk '{ print $2}'`
   export VMR_SUPPORT_PASSWORD=`cf env $SB_APP | grep VMR_SUPPORT_PASSWORD | awk '{ print $2}'`
   export VMR_SUPPORT_USER=`cf env $SB_APP | grep VMR_SUPPORT_USER | awk '{ print $2}'`
   export VMR_ADMIN_PASSWORD=`cf env $SB_APP  | grep VMR_ADMIN_PASSWORD | awk '{print $2}'`
   export VMR_ADMIN_USER=`cf env $SB_APP  | grep VMR_ADMIN_USER | awk '{print $2}'`
   export STARTING_PORT=`cf env $SB_APP | grep STARTING_PORT | awk '{print $2}'`
   export SB_BASE=$SECURITY_USER_NAME:$SECURITY_USER_PASSWORD@$SB_URL
 fi

 if [ "$SB_RUNNING" -eq "1" ]; then
    lookupServiceBrokerVMRs
 fi


}

function lookupServiceBrokerDetails() {

 getServiceBrokerDetails

 if [ "$SB_FOUND" -eq "1" ]; then
 log "ServiceBroker $SB_APP: http://${SB_URL}"
 log "Servicebroker URL BASE: ${SB_BASE} "

 if [ "$SB_RUNNING" -eq "1" ]; then
    lookupServiceBrokerVMRs
    log "Servicebroker LARGE_VMR_LIST: ${LARGE_VMR_LIST} "
    log "Servicebroker SHARED_VMR_LIST: ${SHARED_VMR_LIST} "
    log "Servicebroker LARGE_HA_VMR_LIST: ${LARGE_HA_VMR_LIST} "
    log "Servicebroker LARGE_HA_VMR_PAIRS_LIST: ${LARGE_HA_VMR_PAIRS_LIST} "
    log "Servicebroker LARGE_HA_VMR_PRIMARY_LIST: ${LARGE_HA_VMR_PRIMARY_LIST} "
    log "Servicebroker LARGE_HA_VMR_BACKUP_LIST: ${LARGE_HA_VMR_BACKUP_LIST} "
    log "Servicebroker LARGE_HA_VMR_MONITOR_LIST: ${LARGE_HA_VMR_MONITOR_LIST} "
    log "Servicebroker MEDIUM_HA_VMR_LIST: ${MEDIUM_HA_VMR_LIST} "
    log "Servicebroker MEDIUM_HA_VMR_PAIRS_LIST: ${MEDIUM_HA_VMR_PAIRS_LIST} "
    log "Servicebroker MEDIUM_HA_VMR_PRIMARY_LIST: ${MEDIUM_HA_VMR_PRIMARY_LIST} "
    log "Servicebroker MEDIUM_HA_VMR_BACKUP_LIST: ${MEDIUM_HA_VMR_BACKUP_LIST} "
    log "Servicebroker MEDIUM_HA_VMR_MONITOR_LIST: ${MEDIUM_HA_VMR_MONITOR_LIST} "
    log "Servicebroker ALL_VMR_LIST: ${ALL_VMR_LIST} "
    getServiceBrokerRouterInventory
    log "Servicebroker AvailabilityZones ${AVAILABILITY_ZONE_COUNT} : ${AVAILABILITY_ZONES} "
 else
    log "Servicebroker $SB_APP is not running"
 fi

 else
   log "Could not find solace-pubsub-broker in the current cloud-foundry environment"
 fi

}

function lookupServiceBrokerVMRs() {
 
 INFO_DATA=`curl -sX GET $SB_BASE/info` 

 # Pre 1.1.0 backwards compatibility
 if [ "$(echo $INFO_DATA | jq length)" == "0" ]; then
  deprecated_lookupServiceBrokerVMRs
  return
 fi

 ROUTERS_DATA=`echo $INFO_DATA | jq -c ".messageRouters"`
  
 export ALL_VMR_LIST=$(formatVMRList $(echo $ROUTERS_DATA       | jq -c '.[] | .sshLink'))
 export SHARED_VMR_LIST=$(formatVMRList $(echo $ROUTERS_DATA    | jq -c 'map(select(.poolName == "Shared"))'    | jq -c '.[] | .sshLink'))
 export LARGE_VMR_LIST=$(formatVMRList $(echo $ROUTERS_DATA     | jq -c 'map(select(.poolName == "Large"))'     | jq -c '.[] | .sshLink'))
 
 export MEDIUM_HA_VMR_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_VMR_PAIRS_LIST=$(formatVMRList $(echo $ROUTERS_DATA   | jq -c 'map(select(.poolName == "Medium-HA" and .role != "monitor"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_VMR_PRIMARY_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA" and .role == "primary"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_VMR_BACKUP_LIST=$(formatVMRList $(echo $ROUTERS_DATA  | jq -c 'map(select(.poolName == "Medium-HA" and .role == "backup"))'  | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_VMR_MONITOR_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA" and .role == "monitor"))' | jq -c '.[] | .sshLink'))
 
 export LARGE_HA_VMR_LIST=$(formatVMRList $(echo $ROUTERS_DATA         | jq -c 'map(select(.poolName == "Large-HA"))'                        | jq -c '.[] | .sshLink'))
 export LARGE_HA_VMR_PAIRS_LIST=$(formatVMRList $(echo $ROUTERS_DATA   | jq -c 'map(select(.poolName == "Large-HA" and .role != "monitor"))' | jq -c '.[] | .sshLink'))
 export LARGE_HA_VMR_PRIMARY_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Large-HA" and .role == "primary"))' | jq -c '.[] | .sshLink'))
 export LARGE_HA_VMR_BACKUP_LIST=$(formatVMRList $(echo $ROUTERS_DATA  | jq -c 'map(select(.poolName == "Large-HA" and .role == "backup"))'  | jq -c '.[] | .sshLink'))
 export LARGE_HA_VMR_MONITOR_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Large-HA" and .role == "monitor"))' | jq -c '.[] | .sshLink'))
}

#Deprecated 1.1.0
function deprecated_lookupServiceBrokerVMRs() {

 export ALL_VMR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links`
 export SHARED_VMR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$SHARED_PLAN`
 export LARGE_VMR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_PLAN`
 export MEDIUM_HA_VMR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN`
 export MEDIUM_HA_VMR_PAIRS_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$PAIRS_PARAM`
 export MEDIUM_HA_VMR_PRIMARY_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$PRIMARY_PARAM`
 export MEDIUM_HA_VMR_BACKUP_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$BACKUP_PARAM`
 export MEDIUM_HA_VMR_MONITOR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$MONITOR_PARAM`
 export LARGE_HA_VMR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN`
 export LARGE_HA_VMR_PAIRS_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$PAIRS_PARAM`
 export LARGE_HA_VMR_PRIMARY_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$PRIMARY_PARAM`
 export LARGE_HA_VMR_BACKUP_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$BACKUP_PARAM`
 export LARGE_HA_VMR_MONITOR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$MONITOR_PARAM`

}

function formatVMRList() {
  # Echos formatted results from jq
  echo `echo "$@" | tr -d "\"\n\r" | tr " " ","`
}

function showServiceBrokerVMRs() {

 log "ServiceBroker: VMR Lists "
 echo "ALL_VMR_LIST=${ALL_VMR_LIST}"
 echo "SHARED_VMR_LIST=${SHARED_VMR_LIST}"
 echo "LARGE_VMR_LIST=${LARGE_VMR_LIST}"
 echo "MEDIUM_HA_VMR_LIST=${MEDIUM_HA_VMR_LIST}"
 echo "MEDIUM_HA_VMR_PAIRS_LIST=${MEDIUM_HA_VMR_PAIRS_LIST}"
 echo "MEDIUM_HA_VMR_PRIMARY_LIST=${MEDIUM_HA_VMR_PRIMARY_LIST}"
 echo "MEDIUM_HA_VMR_BACKUP_LIST=${MEDIUM_HA_VMR_BACKUP_LIST}"
 echo "MEDIUM_HA_VMR_MONITOR_LIST=${MEDIUM_HA_VMR_MONITOR_LIST}"
 echo "LARGE_HA_VMR_LIST=${LARGE_HA_VMR_LIST}"
 echo "LARGE_HA_VMR_PAIRS_LIST=${LARGE_HA_VMR_PAIRS_LIST}"
 echo "LARGE_HA_VMR_PRIMARY_LIST=${LARGE_HA_VMR_PRIMARY_LIST}"
 echo "LARGE_HA_VMR_BACKUP_LIST=${LARGE_HA_VMR_BACKUP_LIST}"
 echo "LARGE_HA_VMR_MONITOR_LIST=${LARGE_HA_VMR_MONITOR_LIST}"

}

function checkServiceBrokerRepoStats() {

 log "ServiceBroker: Repo stats $1"
 curl -sX GET $SB_BASE/solace/status/repositories -H "Content-Type: application/json;charset=UTF-8"

 # TODO: Add some parameter driven assertions later

}<commit_msg>Rename<commit_after>#!/usr/bin/env bash

####################################### GLOBALS ###########################################

SHARED_PLAN="af308299-102f-47a3-acb0-7de72be192bf"
SHARED_POOL_NAME="Shared"
LARGE_PLAN="9bd51219-9cee-4570-99ab-ebe80d82c854"
LARGE_POOL_NAME="Large"
MEDIUM_HA_PLAN="9f57fa1c-7bb1-4a48-a651-d0c560fb5730"
MEDIUM_HA_POOL_NAME="Medium-HA"
LARGE_HA_PLAN="6a833e3f-3a24-419d-94d9-4bb38dc51f04"
LARGE_HA_POOL_NAME="Large-HA"

export SOLACE_SERVICE_NAME="solace-pubsub"

export PAIRS_PARAM="includeMonitor=false"
export MONITOR_PARAM="includeBackup=false&includePrimary=false"
export PRIMARY_PARAM="includeMonitor=false&includeBackup=false"
export BACKUP_PARAM="includeMonitor=false&includePrimary=false"

export SB_ORG=${SB_ORG:-"solace"}
export SB_SPACE=${SB_SPACE:-"solace-broker"}

export TEST_ORG=${TEST_ORG:-"solace-test"}
export TEST_SPACE=${TEST_SPACE:-"test"}

export SYSTEM_DOMAIN=${SYSTEM_DOMAIN:-"bosh-lite.com"}
export CF_ADMIN_PASSWORD=${CF_ADMIN_PASSWORD:-"<PASSWORD>"}
export UAA_ADMIN_CLIENT_SECRET=${UAA_ADMIN_CLIENT_SECRET:-"admin-client-secret"}

export JAVA_BUILD_PACK_VERSION=${JAVA_BUILD_PACK_VERSION:-"3.13"}

####################################### FUNCTIONS ###########################################

function log() {
 echo ""
 echo `date` $1
}


function confirmServiceBrokerRunning() {

    getServiceBrokerDetails

    ## Lookup again to confirm and use for message
    SB_RUNNING=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep started | wc -l`
    if [ "$SB_RUNNING" -eq "1" ]; then
      log "confirmServiceBrokerRunning : Service Broker is running"
    else
      log "confirmServiceBrokerRunning : Service Broker is NOT running"
    fi
    ## Will cause an exit in testing ( set -e )
    cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | grep started
    export SB_APP=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | grep started | awk '{ print $1}'`
}

function getServiceBrokerDetails() {
 
 switchToServiceBrokerTarget

 SB_FOUND=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1 | wc -l`
 SB_RUNNING=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep started | wc -l`

 if [ "$SB_FOUND" -eq "1" ]; then
  ## Capture a few details from the service broker
   export SB_APP=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | awk '{ print $1}'`
   export SB_URL=`cf apps | grep -v Getting | grep solace-pubsub-broker | sort | tail -1  | grep $SB_APP | awk '{ print $6}'`
   export SECURITY_USER_NAME=`cf env $SB_APP | grep SECURITY_USER_NAME | awk '{ print $2}'`
   export SECURITY_USER_PASSWORD=`cf env $SB_APP | grep SECURITY_USER_PASSWORD | awk '{ print $2}'`
   export VMR_SUPPORT_PASSWORD=`cf env $SB_APP | grep VMR_SUPPORT_PASSWORD | awk '{ print $2}'`
   export VMR_SUPPORT_USER=`cf env $SB_APP | grep VMR_SUPPORT_USER | awk '{ print $2}'`
   export VMR_ADMIN_PASSWORD=`cf env $SB_APP  | grep VMR_ADMIN_PASSWORD | awk '{print $2}'`
   export VMR_ADMIN_USER=`cf env $SB_APP  | grep VMR_ADMIN_USER | awk '{print $2}'`
   export STARTING_PORT=`cf env $SB_APP | grep STARTING_PORT | awk '{print $2}'`
   export SB_BASE=$SECURITY_USER_NAME:$SECURITY_USER_PASSWORD@$SB_URL
 fi

 if [ "$SB_RUNNING" -eq "1" ]; then
    lookupServiceBrokerVMRs
 fi


}

function lookupServiceBrokerDetails() {

 getServiceBrokerDetails

 if [ "$SB_FOUND" -eq "1" ]; then
 log "ServiceBroker $SB_APP: http://${SB_URL}"
 log "Servicebroker URL BASE: ${SB_BASE} "

 if [ "$SB_RUNNING" -eq "1" ]; then
    lookupServiceBrokerVMRs
    log "Servicebroker LARGE_LIST: ${LARGE_LIST} "
    log "Servicebroker SHARED_LIST: ${SHARED_LIST} "
    log "Servicebroker LARGE_HA_LIST: ${LARGE_HA_LIST} "
    log "Servicebroker LARGE_HA_PAIRS_LIST: ${LARGE_HA_PAIRS_LIST} "
    log "Servicebroker LARGE_HA_PRIMARY_LIST: ${LARGE_HA_PRIMARY_LIST} "
    log "Servicebroker LARGE_HA_BACKUP_LIST: ${LARGE_HA_BACKUP_LIST} "
    log "Servicebroker LARGE_HA_MONITOR_LIST: ${LARGE_HA_MONITOR_LIST} "
    log "Servicebroker MEDIUM_HA_LIST: ${MEDIUM_HA_LIST} "
    log "Servicebroker MEDIUM_HA_PAIRS_LIST: ${MEDIUM_HA_PAIRS_LIST} "
    log "Servicebroker MEDIUM_HA_PRIMARY_LIST: ${MEDIUM_HA_PRIMARY_LIST} "
    log "Servicebroker MEDIUM_HA_BACKUP_LIST: ${MEDIUM_HA_BACKUP_LIST} "
    log "Servicebroker MEDIUM_HA_MONITOR_LIST: ${MEDIUM_HA_MONITOR_LIST} "
    log "Servicebroker ALL_LIST: ${ALL_LIST} "
    getServiceBrokerRouterInventory
    log "Servicebroker AvailabilityZones ${AVAILABILITY_ZONE_COUNT} : ${AVAILABILITY_ZONES} "
 else
    log "Servicebroker $SB_APP is not running"
 fi

 else
   log "Could not find solace-pubsub-broker in the current cloud-foundry environment"
 fi

}

function lookupServiceBrokerVMRs() {
 
 INFO_DATA=`curl -sX GET $SB_BASE/info` 

 # Pre 1.1.0 backwards compatibility
 if [ "$(echo $INFO_DATA | jq length)" == "0" ]; then
  deprecated_lookupServiceBrokerVMRs
  return
 fi

 ROUTERS_DATA=`echo $INFO_DATA | jq -c ".messageRouters"`
  
 export ALL_LIST=$(formatVMRList $(echo $ROUTERS_DATA       | jq -c '.[] | .sshLink'))
 export SHARED_LIST=$(formatVMRList $(echo $ROUTERS_DATA    | jq -c 'map(select(.poolName == "Shared"))'    | jq -c '.[] | .sshLink'))
 export LARGE_LIST=$(formatVMRList $(echo $ROUTERS_DATA     | jq -c 'map(select(.poolName == "Large"))'     | jq -c '.[] | .sshLink'))
 
 export MEDIUM_HA_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_PAIRS_LIST=$(formatVMRList $(echo $ROUTERS_DATA   | jq -c 'map(select(.poolName == "Medium-HA" and .role != "monitor"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_PRIMARY_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA" and .role == "primary"))' | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_BACKUP_LIST=$(formatVMRList $(echo $ROUTERS_DATA  | jq -c 'map(select(.poolName == "Medium-HA" and .role == "backup"))'  | jq -c '.[] | .sshLink'))
 export MEDIUM_HA_MONITOR_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Medium-HA" and .role == "monitor"))' | jq -c '.[] | .sshLink'))
 
 export LARGE_HA_LIST=$(formatVMRList $(echo $ROUTERS_DATA         | jq -c 'map(select(.poolName == "Large-HA"))'                        | jq -c '.[] | .sshLink'))
 export LARGE_HA_PAIRS_LIST=$(formatVMRList $(echo $ROUTERS_DATA   | jq -c 'map(select(.poolName == "Large-HA" and .role != "monitor"))' | jq -c '.[] | .sshLink'))
 export LARGE_HA_PRIMARY_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Large-HA" and .role == "primary"))' | jq -c '.[] | .sshLink'))
 export LARGE_HA_BACKUP_LIST=$(formatVMRList $(echo $ROUTERS_DATA  | jq -c 'map(select(.poolName == "Large-HA" and .role == "backup"))'  | jq -c '.[] | .sshLink'))
 export LARGE_HA_MONITOR_LIST=$(formatVMRList $(echo $ROUTERS_DATA | jq -c 'map(select(.poolName == "Large-HA" and .role == "monitor"))' | jq -c '.[] | .sshLink'))
}

#Deprecated 1.1.0
function deprecated_lookupServiceBrokerVMRs() {

 export ALL_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links`
 export SHARED_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$SHARED_PLAN`
 export LARGE_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_PLAN`
 export MEDIUM_HA_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN`
 export MEDIUM_HA_PAIRS_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$PAIRS_PARAM`
 export MEDIUM_HA_PRIMARY_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$PRIMARY_PARAM`
 export MEDIUM_HA_BACKUP_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$BACKUP_PARAM`
 export MEDIUM_HA_MONITOR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$MEDIUM_HA_PLAN?$MONITOR_PARAM`
 export LARGE_HA_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN`
 export LARGE_HA_PAIRS_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$PAIRS_PARAM`
 export LARGE_HA_PRIMARY_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$PRIMARY_PARAM`
 export LARGE_HA_BACKUP_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$BACKUP_PARAM`
 export LARGE_HA_MONITOR_LIST=`curl -sX GET $SB_BASE/solace/manage/solace_message_routers/links/$LARGE_HA_PLAN?$MONITOR_PARAM`

}

function formatVMRList() {
  # Echos formatted results from jq
  echo `echo "$@" | tr -d "\"\n\r" | tr " " ","`
}

function showServiceBrokerVMRs() {

 log "ServiceBroker: VMR Lists "
 echo "ALL_LIST=${ALL_LIST}"
 echo "SHARED_LIST=${SHARED_LIST}"
 echo "LARGE_LIST=${LARGE_LIST}"
 echo "MEDIUM_HA_LIST=${MEDIUM_HA_LIST}"
 echo "MEDIUM_HA_PAIRS_LIST=${MEDIUM_HA_PAIRS_LIST}"
 echo "MEDIUM_HA_PRIMARY_LIST=${MEDIUM_HA_PRIMARY_LIST}"
 echo "MEDIUM_HA_BACKUP_LIST=${MEDIUM_HA_BACKUP_LIST}"
 echo "MEDIUM_HA_MONITOR_LIST=${MEDIUM_HA_MONITOR_LIST}"
 echo "LARGE_HA_LIST=${LARGE_HA_LIST}"
 echo "LARGE_HA_PAIRS_LIST=${LARGE_HA_PAIRS_LIST}"
 echo "LARGE_HA_PRIMARY_LIST=${LARGE_HA_PRIMARY_LIST}"
 echo "LARGE_HA_BACKUP_LIST=${LARGE_HA_BACKUP_LIST}"
 echo "LARGE_HA_MONITOR_LIST=${LARGE_HA_MONITOR_LIST}"

}

function checkServiceBrokerRepoStats() {

 log "ServiceBroker: Repo stats $1"
 curl -sX GET $SB_BASE/solace/status/repositories -H "Content-Type: application/json;charset=UTF-8"

 # TODO: Add some parameter driven assertions later

}
{'fraction_non_alphanumeric': 0.148288003265806, 'fraction_numerical': 0.011736490279124356, 'mean_word_length': 5.539205872539206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '299182', 'n_tokens_mistral': 8054, 'n_tokens_neox': 7690, 'n_words': 1388}