-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path_core.sh
More file actions
executable file
·49 lines (44 loc) · 1.25 KB
/
_core.sh
File metadata and controls
executable file
·49 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Variables
API_URL="http://192.168.255.5:8085/api/v3/jobs/push"
AUTH_TOKEN="${AUTH_TOKEN}"
TAG_UUID="b541b2fe-1f65-4cfb-b830-d606d0a732ae"
# Lookup server's IP address
TFTP_SERVER_HOSTNAME="ubuntu"
TFTP_SERVER_IP=$(getent hosts "${TFTP_SERVER_HOSTNAME}" | awk '{ print $1 }')
if [ -z "$TFTP_SERVER_IP" ]; then
echo "Could not resolve IP address for ${TFTP_SERVER_HOSTNAME}"
exit 1
fi
COMMAND1="config replace tftp://${TFTP_SERVER_IP}/config_file_core_switch force"
COMMAND2="write memory"
USERNAME="string"
PASSWORD="string"
ENABLE_PASSWORD="string"
CONFIGURE_PASSWORD="string"
# Curl command
curl -X 'POST' ${API_URL} \
-H 'accept: application/json' \
-H "Authorization: ${AUTH_TOKEN}" \
-H 'Content-Type: application/json' \
-d "{
\"commands\": [
\"${COMMAND1}\",
\"${COMMAND2}\"
],
\"requireEnableMode\": true,
\"requireConfigureMode\": false,
\"tagUuids\": [
\"${TAG_UUID}\"
],
\"advancedSettings\": {
\"promptMatchingModeEnum\": \"LEARNING\",
\"overrideTimeouts\": false,
\"timeout\": 0,
\"overrideCredentials\": false,
\"username\": \"${USERNAME}\",
\"password\": \"${PASSWORD}\",
\"enablePassword\": \"${ENABLE_PASSWORD}\",
\"configurePassword\": \"${CONFIGURE_PASSWORD}\"
}
}"