{% 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 %}
