Skip to content

Commit

Permalink
Updated for v1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PackeTsar committed Apr 12, 2020
1 parent dc6cd45 commit 79bcdca
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A Zero-Touch Provisioning system built for Cisco Catalyst switches.

-----------------------------------------
## VERSION ##
The version of FreeZTP documented here is: **dev1.3.1c**
The version of FreeZTP documented here is: **v1.4.0**


-----------------------------------------
Expand Down Expand Up @@ -34,7 +34,7 @@ FreeZTP is a dynamic TFTP server built to automatically configure Cisco Catalyst

-----------------------------------------
## REQUIREMENTS ##
OS: Tested on **CentOS 7** (Recommended), **Ubuntu 16**, and **Raspbian Stretch Lite**
OS: Tested on **CentOS/RHEL 7 and 8** (Recommended), **Ubuntu 16 and 18**, and **Raspbian**

Interpreter: **Python 2.7.5+**

Expand Down Expand Up @@ -614,6 +614,28 @@ Once setup, you can send a test message to the integration destination using the
- **New DHCP scope creation not including ZTP address**: When creating a new scope with something like `ztp set dhcpd TESTSCOPE subnet 10.0.0.0/24`, the `imagediscoveryfile-option` and `lease-time` values would be added to the scope automatically, but not the `ztp-tftp-address`. Some of the `auto_dhcpd()` code was reused to detect current interfaces and add the interface IP address as long as only one interface was present


### v1.4.0
**Bug Fixes in V1.3.1 --> V1.4.0:**
- (#41) **Rasperian GUI broken after FreeZTP install**: The FreeZTP completion script installation location would break GUI profile logins due to incompatibility with sh (vs bash). This would cause an error to be thrown and fail profile logins. The location and installation method of the completion script has been changed to prevent this. Also, an upgrade to v1.4.0 or later will remove the legacy script fixing a broken profile.
- (#35 and #36) **Limit 'show downloads live' to 20 lines**: The `show downloads live` command will now limit output to 20 lines to prevent data overruns and bad display output.
- (#26) **Malformed CSVs will cause a crash**: A malformed CSV will now cause an error to be thrown and CSV data will be partially discarded. Any valid CSV data will still be obtained and processed.
- (#22) **pdb file corruption (on Raspberry Pi's)**: This is likely due to a maintenance routine writing against the pdb file very frequently which is interrupted when the machine loses power. This used to be set to run every second, but now will run every 10 seconds.
- (#47) **Downloads and provisioning time sorting**: `show downloads`, `show downloads live`, and `show provisioning` will now all sort by inverted time; showing the newest entries at the top.
- (#56) **Non-existent keystores cause crash**: If an IDArray is configured with a name not matching a keystore, the FreeZTP service would crash. Now if the IDArray points to a non-existent keystore, the match against the IDArray will be discarded and the system will revert to the default-keystore.
- (#59) **Red Hat Enterprise Linux (RHEL) unsupported**: OS recognition of RHEL7 and RHEL8 have been added to support those platforms.

**Added Features in V1.3.1 --> V1.4.0:**
- (#64) **Global Keystore**: Users are able to define a keystore which will have its contents injected into all merges, regardless of which keystore is matched. The global keystore data will be passed into the matched keystore data under a subordinate key; this key will be equal to the global-keystore ID. See below for an example configuration of this feature. With the below config, the `somevalue` value would be retrieved in a Jinja2 template by using `{{ GLOBAL.somekey}}`. The default setting for `global-keystore` is `none` which disables it.

```
ztp set keystore GLOBAL ztp_ip_address 10.0.0.10
ztp set keystore GLOBAL somekey somevalue
#
#
ztp set global-keystore GLOBAL
```



-----------------------------------------
## CONTRIBUTING ##
Expand Down
4 changes: 2 additions & 2 deletions ztp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
##### https://github.com/packetsar/freeztp #####

##### Inform FreeZTP version here #####
version = "dev1.3.1h"
version = "v1.4.0"


##### Import native modules #####
Expand Down Expand Up @@ -1726,7 +1726,7 @@ def clear(self):
##### Installer class: A simple holder class which contains all of the #####
##### installation scripts used to install/upgrade the ZTP server #####
class installer:
defaultconfig = '''{\n "associations": {\n "SERIAL100": "SHORT_TEMPLATE", \n "STACK1": "LONG_TEMPLATE"\n }, \n "community": "secretcommunity", \n "default-keystore": "DEFAULT_VALUES", \n "default-template": "LONG_TEMPLATE", \n "delay-keystore": 1000, \n "dhcpd": {}, \n "dhcpd-options": {\n "ztp-tftp-address": {\n "code": 150, \n "type": "ip-address"\n }\n }, \n "external-keystores": {}, \n "external-templates": {}, \n "file-cache-timeout": 10, \n "idarrays": {\n "STACK1": [\n "SERIAL1", \n "SERIAL2", \n "SERIAL3"\n ]\n }, \n "image-supression": 3600, \n "imagediscoveryfile": "freeztp_ios_upgrade", \n "imagefile": "cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.bin", \n "initialfilename": "network-confg", \n "integrations": {}, \n "keyvalstore": {\n "DEFAULT_VALUES": {\n "hostname": "UNKNOWN_HOST", \n "vl1_ip_address": "dhcp"\n }, \n "SERIAL100": {\n "hostname": "SOMEDEVICE", \n "vl1_ip_address": "10.0.0.201"\n }, \n "STACK1": {\n "hostname": "CORESWITCH", \n "vl1_ip_address": "10.0.0.200", \n "vl1_netmask": "255.255.255.0"\n }\n }, \n "logging": {\n "merged-config-to-custom-file": "disable", \n "merged-config-to-mainlog": "enable"\n }, \n "snmpoid": {\n "WS_C2960_SERIAL_NUMBER": "1.3.6.1.2.1.47.1.1.1.1.11.1001", \n "WS_C3850_SERIAL_NUMBER": "1.3.6.1.2.1.47.1.1.1.1.11.1000"\n }, \n "starttemplate": {\n "delineator": "^", \n "value": "hostname {{ autohostname }}\\n!\\nsnmp-server community {{ community }} RO\\n!\\nend"\n }, \n "suffix": "-confg", \n "templates": {\n "LONG_TEMPLATE": {\n "delineator": "^", \n "value": "hostname {{ hostname }}\\n!\\ninterface Vlan1\\n ip address {{ vl1_ip_address }} {{ vl1_netmask }}\\n no shut\\n!\\n!{% for interface in range(1,49) %}\\ninterface GigabitEthernet1/0/{{interface}}\\n description User Port (VLAN 1)\\n switchport access vlan 1\\n switchport mode access\\n no shutdown\\n!{% endfor %}\\n!\\nip domain-name test.com\\n!\\nusername admin privilege 15 secret password123\\n!\\naaa new-model\\n!\\n!\\naaa authentication login CONSOLE local\\naaa authorization console\\naaa authorization exec default local if-authenticated\\n!\\ncrypto key generate rsa modulus 2048\\n!\\nip ssh version 2\\n!\\nline vty 0 15\\nlogin authentication default\\ntransport input ssh\\nline console 0\\nlogin authentication CONSOLE\\nend"\n }, \n "SHORT_TEMPLATE": {\n "delineator": "^", \n "value": "hostname {{ hostname }}\\n!\\ninterface Vlan1\\n ip address {{ vl1_ip_address }} 255.255.255.0\\n no shut\\n!\\nend"\n }\n }, \n "tftproot": "/etc/ztp/tftproot/"\n}'''
defaultconfig = '''{\n "associations": {\n "SERIAL100": "SHORT_TEMPLATE", \n "STACK1": "LONG_TEMPLATE"\n }, \n "community": "secretcommunity", \n "default-keystore": "DEFAULT_VALUES", \n "default-template": "LONG_TEMPLATE", \n "delay-keystore": 1000, \n "dhcpd": {}, \n "dhcpd-options": {\n "ztp-tftp-address": {\n "code": 150, \n "type": "ip-address"\n }\n }, \n "external-keystores": {}, \n "external-templates": {}, \n "file-cache-timeout": 10, \n "global-keystore": null, \n "idarrays": {\n "STACK1": [\n "SERIAL1", \n "SERIAL2", \n "SERIAL3"\n ]\n }, \n "image-supression": 3600, \n "imagediscoveryfile": "freeztp_ios_upgrade", \n "imagefile": "cat3k_caa-universalk9.SPA.03.06.06.E.152-2.E6.bin", \n "initialfilename": "network-confg", \n "integrations": {}, \n "keyvalstore": {\n "DEFAULT_VALUES": {\n "hostname": "UNKNOWN_HOST", \n "vl1_ip_address": "dhcp"\n }, \n "SERIAL100": {\n "hostname": "SOMEDEVICE", \n "vl1_ip_address": "10.0.0.201"\n }, \n "STACK1": {\n "hostname": "CORESWITCH", \n "vl1_ip_address": "10.0.0.200", \n "vl1_netmask": "255.255.255.0"\n }\n }, \n "logging": {\n "merged-config-to-custom-file": "disable", \n "merged-config-to-mainlog": "enable"\n }, \n "snmpoid": {\n "WS_C2960_SERIAL_NUMBER": "1.3.6.1.2.1.47.1.1.1.1.11.1001", \n "WS_C3850_SERIAL_NUMBER": "1.3.6.1.2.1.47.1.1.1.1.11.1000"\n }, \n "starttemplate": {\n "delineator": "^", \n "value": "hostname {{ autohostname }}\\n!\\nsnmp-server community {{ community }} RO\\n!\\nend"\n }, \n "suffix": "-confg", \n "templates": {\n "LONG_TEMPLATE": {\n "delineator": "^", \n "value": "hostname {{ hostname }}\\n!\\ninterface Vlan1\\n ip address {{ vl1_ip_address }} {{ vl1_netmask }}\\n no shut\\n!\\n!{% for interface in range(1,49) %}\\ninterface GigabitEthernet1/0/{{interface}}\\n description User Port (VLAN 1)\\n switchport access vlan 1\\n switchport mode access\\n no shutdown\\n!{% endfor %}\\n!\\nip domain-name test.com\\n!\\nusername admin privilege 15 secret password123\\n!\\naaa new-model\\n!\\n!\\naaa authentication login CONSOLE local\\naaa authorization console\\naaa authorization exec default local if-authenticated\\n!\\ncrypto key generate rsa modulus 2048\\n!\\nip ssh version 2\\n!\\nline vty 0 15\\nlogin authentication default\\ntransport input ssh\\nline console 0\\nlogin authentication CONSOLE\\nend"\n }, \n "SHORT_TEMPLATE": {\n "delineator": "^", \n "value": "hostname {{ hostname }}\\n!\\ninterface Vlan1\\n ip address {{ vl1_ip_address }} 255.255.255.0\\n no shut\\n!\\nend"\n }\n }, \n "tftproot": "/etc/ztp/tftproot/"\n}'''
def minor_update_script(self):
newconfigkeys = {
"integrations": {},
Expand Down

0 comments on commit 79bcdca

Please sign in to comment.