Skip to content
This repository has been archived by the owner on Mar 7, 2018. It is now read-only.

Commit

Permalink
Merge pull request #104 from mirceaulinic/JINJA-TPL
Browse files Browse the repository at this point in the history
Jinja SNMP template
  • Loading branch information
mirceaulinic committed Dec 7, 2016
2 parents 61793ce + 64832f8 commit 7e0d53c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
14 changes: 14 additions & 0 deletions napalm_eos/templates/delete_snmp_config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if (location is defined) and location %}
no snmp-server location "{{location}}"
{% endif %}
{% if (contact is defined) and contact %}
no snmp-server contact "{{contact}}"
{% endif %}
{% if (chassis_id is defined) and chassis_id %}
no snmp-server chassis-id "{{chassis_id}}"
{% endif %}
{% if (community is defined) and community %}
{% for comm_name, comm_details in community.iteritems() %}
no community {{comm_name}}
{% endfor %}
{% endif %}
22 changes: 22 additions & 0 deletions napalm_eos/templates/snmp_config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% if (location is defined) and location %}
snmp-server location "{{location}}"
{% endif %}
{% if (contact is defined) and contact %}
snmp-server contact "{{contact}}"
{% endif %}
{% if (chassis_id is defined) and chassis_id %}
snmp-server chassis-id "{{chassis_id}}"
{% endif %}
{% if (community is defined) and community %}
{% for comm_name, comm_details in community.iteritems() %}
{% if (comm_details is defined) and comm_details %}
{% if (comm_details.get('mode') is defined) and comm_details.get('mode') == 'rw' %}
community {{comm_name}} rw
{% else %}
community {{comm_name}} ro
{% endif %}
{% else %}
community {{comm_name}} ro
{% endif %}
{% endfor %}
{% endif %}

0 comments on commit 7e0d53c

Please sign in to comment.