diff --git a/scripts/backup_network_core b/scripts/backup_network_core new file mode 100644 index 0000000..cd9a758 --- /dev/null +++ b/scripts/backup_network_core @@ -0,0 +1,45 @@ +#! /bin/sh +set -eu + +# Script to backup current configuration of the network core switch. + +CORE_SWITCH=10.0.0.0 +TFTP_HOST=10.64.0.150 +CONFIG_NAME=CoreConfig.txt + +# Create an Entry and Wait +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.14.777 i 5 + +# Set Copy protocol to tftp +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.2.777 i 1 + +# Set copy to tftp server +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.3.777 i 4 + +# Set copy from config +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.4.777 i 1 + +# Set tftp server address +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.5.777 a ${TFTP_HOST} + +# Set destination file name +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.6.777 s ${CONFIG_NAME} + +# Activate the entry +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.14.777 i 1 + +# Verify the copy was successful +snmpwalk -v2c -c COMMUNITY ${CORE_SWITCH} \ + ccCopyState + +# Once successful, destroy the entry +snmpset -v2c -c COMMUNITY ${CORE_SWITCH} \ + .1.3.6.1.4.1.9.9.96.1.1.1.1.14.777 i 6 +