Package: netbox-plugin-software-manager
Software Manager - NetBox pluginNetBoxplugin to manage software for your Cisco devices in following aspects:software repository (download does not work after Gunicorn was changed to nginx-unit, trying to manage with it)assign target (golden) image on created Device Typesget software version compliance report for every device in Excel formatscheduled upload golden image on devicesscheduled reload devices with golden imageImportant notesCompatible with NetBox 2.9 and higher versions only.Plugin works with standalone IOS/IOS-XE boxes only. No Stacks/VSS/StackWiseVirtual at present.Plugin operates with software version only, and does not consider feature set (lanlite vs lanbase, K9 vs NPE).Test in your local sandbox, do not jump to production network.Use this plugin on production network at one's own risk with take responsibility for any potential outages due to reload of devices.Software RepositoryMain pageAdd/Edit software pageSelect *.bin file, specify expected MD5 (from cisco site) and verbose version. Plugin calculates MD5 when file uploading and result should matches with entered MD5, otherwise MD5 will be redded.Golden ImagesMain pageAssigned Image/Version for all created DeviceTypes with upgrade progress for particular DeviceType. "Export" button provides detailed Excel report.Upgrade DevicesMain pageprovides information about Target/Current versions (green = match, yellow = upgrade is required)Add scheduled taskSelect job type:upload (transfer golden image to the box)upgrade (reload with golden image w/o transfer)select time to start or set "Start Now". Time is based on NetBox TimeZone, not your browser/hostPC.select MW duration. All tasks will be skipped after this time (countdown starts from scheduled time, not from time of creation tasks)Scheduled tasks listList of all scheduled/completed tasks.Tasks with Running status can be deleted in admin view only.Plugin has acknowledgment logic to try to prevent mass outage. ACK flag become True only in case of getting expected result. In case of any unknown error/traceback job will be finished with ACK=False. Any new job checks number of non-ACK and can be skpped if this number crossed threshold. ACK flag can be changed manually by clicking on "V" or "X".Scheduled tasks infoDetailed information about task and execution log.InstallationInstruction below describes installation for Docker-compose instance of NetBox.For bare-metal setup pip can be used for installation. But some changes (ftp/redis etc) will be requared anyway.pipinstallnetbox-plugin-software-manager1. Create new docker image based on latest-ldap netbox imagecd{{your-netbox-locaton}}gitclonehttps://github.com/alsigna/netbox-software-manager.gitcdnetbox-software-manager
dockerbuild-tnetbox-plugin.Dockerfile:FROMnetboxcommunity/netbox:latest-ldap# install scrapli[paramiko], rq-scheduler, xlsxwriterCOPYrequirements.txt/requirements.txtRUN/opt/netbox/venv/bin/python-mpipinstall-r/requirements.txt# make folder for image location. Shold be in django media folder# folder name (software-images in example) is used as FTP username and should be copied to NetBox configuration.py file. Remember this name.RUNmkdir/opt/netbox/netbox/media/software-images/RUNchown-Runit:unit/opt/netbox/netbox/media/software-images# Add additional queue (software_manager in example). This name should be copied to NetBox configuration.py. Remember this name.RUNecho$'\n\RQ_QUEUES["software_manager"]=RQ_PARAMS\n\'>>/opt/netbox/netbox/netbox/settings.py# Install plugin from local repository#--SoftwareManagerCOPY./software_manager//source/SoftwareManager/software_manager/COPY./setup.py/source/SoftwareManager/COPY./README.md/source/SoftwareManager/COPY./MANIFEST.in/source/SoftwareManager/#--PipRUN/opt/netbox/venv/bin/python-mpipinstall/source/SoftwareManager/2. Create FTP docker image based ondocker-alpine-ftp-serverWhy FTP? Originally scp was used to transfer files, but based on experience, FTP is much faster.HTTP was added in 0.0.3, But FTP_USERNAME in configuration still required as it used as folder name for IOS uploadcdftp
dockerbuild-tftp_for_netbox.cd../../orcdhttp
dockerbuild-thttp_for_netbox.cd../../3. Change docker-compose.yml...netbox-server:&netbox-server#Changeimagenameto"customized"imagefromstep1.image:netbox-pluginvolumes:#Mountlogfile.Pathhavetomatchwithspecifiedinconfiguration.py-./netbox-software-manager/upgrade.log:/var/log/upgrade.log:z#Replacenginx-unitconfig-./netbox-software-manager/nginx-unit.json:/etc/unit/nginx-unit.json:z,ro#MountfolderwithIOSimages.NetBoxwillupload/deleteimages.#Format:/opt/netbox/netbox/media/{{FTP_SERVER_USRNAME}}-./netbox-software-manager/software-images:/opt/netbox/netbox/media/software-images:z#Mountscriptforrq-./netbox-software-manager/rq.sh:/etc/netbox/rq.sh:z,ro
...netbox-worker:#Runscriptinsteadofsingleworkercommand:/bin/bash/etc/netbox/rq.sh#Commentoriginalconfig:#entrypoint:#-/opt/netbox/venv/bin/python#-/opt/netbox/netbox/manage.py#command:#-rqworker...#FTPserverfromstep2.ftp:image:ftp_for_netboxports:-"21:21"-"21000-21100:21000-21100"privileged:truevolumes:#MountfolderwithIOSimages.FTPhasROonly.-./netbox-software-manager/software-images:/ftp/software-images:z,ro#Mountconfigurationfiles-./netbox-software-manager/ftp/start_vsftpd.sh:/etc/vsftpd/start_vsftpd.sh:z,ro-./netbox-software-manager/ftp/vsftpd.conf:/etc/vsftpd/vsftpd.conf:z,roentrypoint:/etc/vsftpd/start_vsftpd.shenvironment:#Specifyuser/password-USERS=software-images|ftp_password#Yourexternal(host)IPaddress,notcontaner'sIP-ADDRESS=192.168.0.1#simplehttpserverhttp:image:http_for_netboxports:-"80:80"volumes:#MountfolderwithIOSimages.FTPhasROonly.-./netbox-software-manager/software-images:/usr/share/nginx/html:z,ro4. Change NetBox configuration.pyPLUGINS=['software_manager',]PLUGINS_CONFIG={'software_manager':{# Device credentials'DEVICE_USERNAME':'cisco','DEVICE_PASSWORD':'cisco',# FTP credentials'FTP_USERNAME':'software-images','FTP_PASSWORD':'ftp_password','FTP_SERVER':'192.168.0.1',# HTTP server name with patch to images"HTTP_SERVER":"http://192.168.0./",# Default transport method, can be also changed while scheduling task, [tfp|http]"DEFAULT_TRANSFER_METHOD":"ftp",# Log file'UPGRADE_LOG_FILE':'/var/log/upgrade.log',# Queue name. Check step 1. Should be the same'UPGRADE_QUEUE':'software_manager',# Threshold for non-ACK check'UPGRADE_THRESHOLD':2,# Number of tries to connect to device before declare that we lost it.'UPGRADE_MAX_ATTEMPTS_AFTER_RELOAD':10,# Hold timer between tries'UPGRADE_SECONDS_BETWEEN_ATTEMPTS':60,# Custom field name which is used for store current SW version'CF_NAME_SW_VERSION':'sw_version',}}6. Restart docker-compose7. Add Custom FieldNameTypeLabelObject(s)sw_versionTextSW Versiondcim > device8. Try to usenginx-unit.jsonOriginal NetBox config is used with max_body_size:"settings":{"http":{"max_body_size":1073741824}}rq.sh script#!/bin/bash# start multply rqworkers for "software_manager", check name if you customized it. There are 5 workers. This means up to 5 concurrent jobs can be run at the same time./opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkersoftware_manager&/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkersoftware_manager&/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkersoftware_manager&/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkersoftware_manager&/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkersoftware_manager&# start scheduler/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqscheduler&# start default netbox worker/opt/netbox/venv/bin/python/opt/netbox/netbox/manage.pyrqworkercheck_releasesdefaultexec"$@"