ISE API Shell Patterns
Overview
These patterns combine netapi ise commands with jq and shell formatting for professional, colorized output. Use them directly or include in runbooks.
Usage
Include any pattern in your documentation:
include::example$ise-api-patterns.adoc[tag=policy-sets-table]
Policy Sets
Table with Hit Counts
# Policy Sets with status indicators and hit counts
echo -e "\e[1;37m # POLICY SET HITS STATE\e[0m"
echo -e "\e[90m ─────────────────────────────────────────────────\e[0m"
netapi ise api-call openapi GET '/api/v1/policy/network-access/policy-set' | \
jq -r '.response[] | "\(.rank)|\(.name)|\(.hitCounts // 0)|\(.state)"' | \
while IFS='|' read rank name hits state; do
if [[ "$state" == "enabled" ]]; then
printf " \e[1;33m%d\e[0m \e[1;36m%-28s\e[0m \e[1;32m%6s\e[0m \e[1;32m●\e[0m\n" "$rank" "$name" "$hits"
else
printf " \e[90m%d\e[0m \e[90m%-28s\e[0m \e[90m%6s\e[0m \e[1;31m○\e[0m\n" "$rank" "$name" "$hits"
fi
done
Example Output
# POLICY SET HITS STATE ───────────────────────────────────────────────── 0 Domus-Wired MAB 15 ● 1 Domus-Wired 802.1X 103 ● 2 Domus-Secure 802.1X 100 ● 3 Domus-IoT iPSK 17 ● 4 Domus-Guest 0 ○ 5 Default 1 ●
Status Indicators
# Policy Sets with enabled/disabled indicators
netapi ise api-call openapi GET '/api/v1/policy/network-access/policy-set' | \
jq -r '.response[] | "\(.name)|\(.state)"' | while IFS='|' read name state; do
if [[ "$state" == "enabled" ]]; then
printf "\e[1;32m●\e[0m \e[1;36m%s\e[0m\n" "$name"
else
printf "\e[1;31m○\e[0m \e[90m%s\e[0m\n" "$name"
fi
done
Example Output
● Domus-Wired MAB ● Domus-Wired 802.1X ○ Domus-Guest
Numbered List
# Policy Sets numbered list with colors
netapi ise api-call openapi GET '/api/v1/policy/network-access/policy-set' | \
jq -r '.response[] | .name' | nl | while read num name; do
printf "\e[1;33m%2d.\e[0m \e[1;36m%s\e[0m\n" "$num" "$name"
done
Box Format
# Policy Sets in a box
echo -e "\e[1;35m╭─────────────────────────────────╮\e[0m"
echo -e "\e[1;35m│\e[0m \e[1;37mISE Policy Sets\e[0m \e[1;35m│\e[0m"
echo -e "\e[1;35m├─────────────────────────────────┤\e[0m"
netapi ise api-call openapi GET '/api/v1/policy/network-access/policy-set' | \
jq -r '.response[] | .name' | while read name; do
printf "\e[1;35m│\e[0m \e[1;36m%-31s\e[0m \e[1;35m│\e[0m\n" "$name"
done
echo -e "\e[1;35m╰─────────────────────────────────╯\e[0m"
dACLs and Authorization
Utilities
Logging with tee
# Log command output to file while displaying
LOGFILE="/tmp/ise-validation-$(date +%Y%m%d-%H%M%S).log"
netapi ise api-call openapi GET '/api/v1/deployment/node' | tee -a "$LOGFILE" | jq '.response[].hostname'
echo "Log saved to: $LOGFILE"