Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Changed jinja file extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mierdin committed Aug 7, 2014
1 parent f8dbcc8 commit 68b558e
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 4 deletions.
2 changes: 0 additions & 2 deletions config.yaml
Expand Up @@ -15,8 +15,6 @@
coresnippets:
- features
- vlans
- vsans
- fcalias
- qos
- ports
- misc
Expand Down
2 changes: 1 addition & 1 deletion main.py
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#/usr/bin/env python
""" jinja2-nxos-config
Accepts arguments from YAML config file
Expand Down
2 changes: 1 addition & 1 deletion methods.py
Expand Up @@ -22,5 +22,5 @@ def gen_snippet(snippet, config):
"config" represents the portion of the YAML
file applicable to this snippet"""

template = ENV.get_template(snippet)
template = ENV.get_template(snippet + ".j2")
return template.render(config=config)
4 changes: 4 additions & 0 deletions snippets/features.j2
@@ -0,0 +1,4 @@
{# handle different feature syntaxes - currently statically defining commands in list #}
{% for feature in config|sort %}
{{- feature }}
{% endfor %}
18 changes: 18 additions & 0 deletions snippets/misc.j2
@@ -0,0 +1,18 @@
hostname {{ config['hostname'] }}

{# snmp-server user admin network-admin auth md5 -- priv -- localizedkey #}
snmp-server host {{ config['snmp']['traphost'] }} traps version 2c public udp-port 2162
{# snmp-server community -- group network-operator #}
{# snmp-server community -- use-acl acl_for_ro_comm #}

{% for ntpserver in config['ntp'] -%}
ntp server {{ ntpserver }} use-vrf management
{% endfor %}
{# TODO: Need to find a way to insert "prefer" keyword #}
ntp source-interface mgmt0

vrf context management
ip route 0.0.0.0/0 {{ config['mgmtgw']}}

spanning-tree domain 101
spanning-tree vlan 1-4093 priority 4096
3 changes: 3 additions & 0 deletions snippets/ports.j2
@@ -0,0 +1,3 @@
interface Ethernet {{ config['trunks'] }}
switchport mode trunk
{# need to have a loop here #}
1 change: 1 addition & 0 deletions snippets/qos.j2
@@ -0,0 +1 @@
class-map type qos match-all class-gold description NFS Traffic match cos 4class-map type qos match-all class-bronze description Reserved for Future Use match cos 1class-map type qos match-all class-silver description vMotion Traffic match cos 2class-map type qos match-all class-platinum description Reserved for Future Use match cos 5class-map type queuing class-gold description NFS Traffic match qos-group 4class-map type queuing class-bronze description Reserved for Future Use match qos-group 2class-map type queuing class-silver description vMotion Traffic match qos-group 3class-map type queuing class-platinum description Reserved for Future Use match qos-group 5policy-map type qos system-level-qos class class-platinum set qos-group 5 class class-gold set qos-group 4 class class-silver set qos-group 3 class class-bronze set qos-group 2 class class-fcoe set qos-group 1policy-map type queuing Uplink-out_policy class type queuing class-platinum class type queuing class-gold bandwidth percent 40 class type queuing class-silver bandwidth percent 5 class type queuing class-bronze class type queuing class-default bandwidth percent 35 class type queuing class-fcoe bandwidth percent 20class-map type network-qos class-gold description NFS Traffic match qos-group 4class-map type network-qos class-bronze description Reserved for Future Use match qos-group 2class-map type network-qos class-silver description vMotion Traffic match qos-group 3class-map type network-qos class-platinum description Reserved for Future Use match qos-group 5policy-map type network-qos system-level-net-qos class type network-qos class-platinum set cos 5 mtu 9216 class type network-qos class-gold set cos 4 mtu 9216 class type network-qos class-silver set cos 2 mtu 9216 class type network-qos class-bronze set cos 1 mtu 9216 class type network-qos class-fcoe pause no-drop mtu 2158 class type network-qos class-default mtu {{ config['defaultmtu'] }} multicast-optimizesystem qos service-policy type queuing input fcoe-default-in-policy service-policy type qos input system-level-qos service-policy type queuing output Uplink-out_policy service-policy type network-qos system-level-net-qos
Expand Down
6 changes: 6 additions & 0 deletions snippets/vlans.j2
@@ -0,0 +1,6 @@
!VLAN Database
{% for id, name in config|dictsort -%}
vlan {{ id }}
name {{ name }}
{# fabricpath #}
{% endfor %}

0 comments on commit 68b558e

Please sign in to comment.