{% extends "exodus-template.html" %}

{% block content %}
<a href="{% url exodus.views.viewNodelist %}">Node List</a>

<div style="border:1px solid #000000;">
<h1> {{ node.name }} </h1>
<h3> Location </h3>
Description: {{ node.location.description }} <br>
Longitude: {{ node.location.longitude }} <br>
Latitude: {{ node.location.latitude }} <br>

Master ip: {{ node.masterip }} <br>
<a href="{% url exodus.views.genericNode "edit" node.name %}">EDIT</a>
<a href="{% url exodus.views.genericNode "delete" node.name %}">DELETE</a>
</div>

<h2>Interfaces</h2>
<a href="{% url exodus.views.genericInterface "add" node.name "new" %}">Add new interface</a><p />

{% for nic in node.interface_set.all %}
	<div style="border:1px solid #000000;">
	<div style="border:1px solid #000000;">
	<h3>iface: {{ nic.iface }} </h3>
	<a href="{% url exodus.views.genericPublicAP "add" node.name nic.iface "new" %}">Add new public access point</a><p />
	Description: {{ nic.shortdesc }} <br>
	IP: {{ nic.ip }}/{{ nic.netmask }}<br />
	Type: {% ifequal nic nic.link %}Master{% else %}Slave {% endifequal %}<br />
	
	{% ifnotequal nic.type "eth" %}
		SSID: {{ nic.ssid }} <br>
		Channel: {{ nic.channel }} <br>
		Antenna: {{ nic.antenna }} <br>
		Polar: {{ nic.polar }} <br>	
		Mode: {{ nic.mode }} <br>
	{% endifnotequal %}
	<a href="{% url exodus.views.genericInterface "edit" node.name nic.iface %}">EDIT</a>
	<a href="{% url exodus.views.genericInterface "delete" node.name nic.iface %}">DELETE</a>
	</div>

	{% for interlink in nic.link.interface_set.all %}
		{% ifnotequal interlink nic %}
		<ul>
		<li>Interlink to Node: <a href="{% url exodus.views.viewNode interlink.node %}">
			{{ interlink.node }}</a> </li>
		<li>Link Name: {{ interlink }}</li>
		<li>IP: {{ interlink.ip }}/{{ interlink.netmask }} </li>
		</ul>
		{% endifnotequal %}
	{% endfor %}
	<ol>
	{% for accessPoint in nic.ap.all %}
		<div style="border:1px solid #000000;">
		<p />
		<li>Public Access Point: {{ accessPoint.ip}}/{{accessPoint.netmask }}
		<a href="{% url exodus.views.genericPublicAP "edit" node.name nic.iface accessPoint.pk %}">EDIT</a>
		<a href="{% url exodus.views.genericPublicAP "delete" node.name nic.iface accessPoint.pk %}">DELETE</a>
		{% for dhcp in accessPoint.dhcpstatic.all %}
			<ul>
			    <li>Hostname: {{ dhcp.hostname }} </li>
			    <li>MacAddress: {{ dhcp.macaddress }} </li>
			</ul>
		{% endfor %}
        </li>
		<p />
		</div>
	{% endfor %}
	</ol>
	</div>
	<p />
{% endfor %}

{% endblock %}
