mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
rearrange instance network to show ipv4 and ipv6 address. Add capability to show all ip address not one of them. Add ipv4 address to instance summary
This commit is contained in:
parent
f2ba2b58b0
commit
8b9fe4e887
2 changed files with 66 additions and 41 deletions
|
@ -34,6 +34,11 @@
|
|||
{% for disk in disks %}
|
||||
{{ disk.size|filesizeformat }} {% trans "Disk" %} |
|
||||
{% endfor %}
|
||||
{% for net in networks %}
|
||||
{% for ipv4 in net.ipv4|default:"-" %}
|
||||
{{ ipv4 }} |
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<button
|
||||
{% if guest_agent == True %}
|
||||
{% if guest_agent_ready == True %}
|
||||
|
@ -895,44 +900,27 @@
|
|||
|
||||
<div class="col-xs-12 col-sm-12">
|
||||
<p><strong>{% trans "Network Devices" %}</strong></p>
|
||||
<table class="table table-hover">
|
||||
<table class="table table-striped table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'MAC' %}</th>
|
||||
<th>{% trans 'IP Address' %}</th>
|
||||
<th>{% trans 'Source' %}</th>
|
||||
<th>{% trans 'LinkState' %}</th>
|
||||
<th>{% trans 'Filter' %}</th>
|
||||
<th>{% trans 'Qos' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
<th class="hidden-xs hidden-sm" colspan="6">{% trans 'Info' %}</th>
|
||||
<th class="visible-xs visible-sm" colspan="2">{% trans 'Info' %}</th>
|
||||
<th colspan="2">{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for network in networks %}
|
||||
<tr>
|
||||
<td class="col-sm-1">eth{{ forloop.counter0 }}({{ network.target|default:"no target" }})</td>
|
||||
<td rowspan="2">eth{{ forloop.counter0 }}({{ network.target|default:"no target" }})</td>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'MAC' %}</th>
|
||||
<td>{{ network.mac }}</td>
|
||||
<td>{{ network.ipv4|default:"unknown" }}</td>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'Filter' %}</th>
|
||||
<td class="hidden-xs">{{ network.filterref|default:"None" }}</td>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'Source' %}</th>
|
||||
<td>{{ network.nic }}</td>
|
||||
<td>
|
||||
<form method="post">{% csrf_token %}
|
||||
<input name="mac" value="{{ network.mac }}" hidden/>
|
||||
<input name="set_link_state" value="{{ network.state }}" hidden/>
|
||||
<input type="checkbox" {% if network.state == 'up' %} checked
|
||||
{% endif %} onclick='submit();' />
|
||||
{% trans 'active' %}
|
||||
</form>
|
||||
</td>
|
||||
<td>{{ network.filterref|default:"None" }}</td>
|
||||
<td>
|
||||
<form class="form-horizontal" method="post" name="add_qos{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<input type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}" hidden/>
|
||||
{% include 'add_network_qos.html' with id=forloop.counter0 %}
|
||||
</form>
|
||||
</td>
|
||||
<td class="col-sm-2">
|
||||
<form class="form-horizontal" method="post" name="set_qos{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<form class="form-horizontal" method="post" name="edit_network{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<button data-target="#editInstanceNetwork{{ forloop.counter0 }}" type="button" class="btn btn-sm btn-primary"
|
||||
title="Edit NIC" data-toggle="modal">
|
||||
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
|
||||
|
@ -947,13 +935,13 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-inline">
|
||||
<label class="col-sm-2 control-label">{% trans "MAC" %} </label>
|
||||
<label class="col-sm-3 control-label">{% trans "MAC Addr" %} </label>
|
||||
<input class="form-control" type="text" value="{{ network.mac }}" readonly/>
|
||||
<label class="control-label"><em>to</em></label>
|
||||
<input class="form-control" type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}"/>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="col-sm-2 control-label">{% trans "NIC" %} </label>
|
||||
<label class="col-sm-3 control-label">{% trans "Net Source" %} </label>
|
||||
<input class="form-control" type="text" value="{{ network.nic }}" readonly/>
|
||||
<label class="control-label"><em>to</em></label>
|
||||
<select class="form-control" name="net-source-{{ forloop.counter0 }}">
|
||||
|
@ -966,7 +954,7 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="form-group form-inline">
|
||||
<label class="col-sm-2 control-label">{% trans "Filter" %} </label>
|
||||
<label class="col-sm-3 control-label">{% trans "NW Filter" %} </label>
|
||||
<input class="form-control" type="text" value="{{ network.filterref }}" readonly/>
|
||||
<label class="control-label"><em>to</em></label>
|
||||
<select class="form-control" name="net-nwfilter-{{ forloop.counter0 }}">
|
||||
|
@ -976,17 +964,54 @@
|
|||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-primary btn-block" name="change_network" title="{% trans "Apply Network Changes" %}">{% trans "Apply" %}</button>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button class="btn btn-default" data-dismiss="modal">{% trans 'Close' %}</button>
|
||||
<button class="btn btn-success" name="change_network" title="{% trans "Apply Network Changes" %}">{% trans "Apply" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</td>
|
||||
<td align="right">
|
||||
<form method="post" name="delete_network" role="form">{% csrf_token %}
|
||||
<button class="btn btn-sm btn-danger" value="{{ network.mac }}" name="delete_network" title="{% trans "Delete Device" %}"
|
||||
onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
<i class="glyphicon glyphicon-trash"></i>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'IPv4' %}</th>
|
||||
<td>
|
||||
{% for ipv4 in network.ipv4|default:"unknown" %}
|
||||
{{ ipv4 }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'IPv6' %}</th>
|
||||
<td class="hidden-xs">
|
||||
{% for ipv6 in network.ipv6|default:"unknown" %}
|
||||
{{ ipv6 }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<th class="hidden-xs hidden-sm">{% trans 'LinkState' %}</th>
|
||||
<td>
|
||||
<form method="post">{% csrf_token %}
|
||||
<input name="mac" value="{{ network.mac }}" hidden/>
|
||||
<input name="set_link_state" value="{{ network.state }}" hidden/>
|
||||
<input type="checkbox" {% if network.state == 'up' %} checked
|
||||
{% endif %} onclick='submit();' />
|
||||
{% trans 'active' %}
|
||||
</form>
|
||||
</td>
|
||||
<th>{% trans 'QoS' %}</th>
|
||||
<td align="right">
|
||||
<form class="form-horizontal" method="post" name="add_qos{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<input type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}" hidden/>
|
||||
{% include 'add_network_qos.html' with id=forloop.counter0 %}
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
@ -1002,7 +1027,7 @@
|
|||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Direction" %}</th>
|
||||
<th>{% trans "MAC/Direction" %}</th>
|
||||
<th>{% trans "Average" %}</th>
|
||||
<th>{% trans "Peak" %}</th>
|
||||
<th>{% trans "Burst" %}</th>
|
||||
|
|
|
@ -287,8 +287,8 @@ class wvmInstance(wvmConnect):
|
|||
leases = []
|
||||
|
||||
def extract_dom(info):
|
||||
ipv4 = None
|
||||
ipv6 = None
|
||||
ipv4 = []
|
||||
ipv6 = []
|
||||
for addrs in info.values():
|
||||
if addrs["hwaddr"] != iface_mac:
|
||||
continue
|
||||
|
@ -296,20 +296,20 @@ class wvmInstance(wvmConnect):
|
|||
continue
|
||||
for addr in addrs["addrs"]:
|
||||
if addr["type"] == 0:
|
||||
ipv4 = addr["addr"]
|
||||
ipv4.append(addr["addr"])
|
||||
elif (addr["type"] == 1 and
|
||||
not str(addr["addr"]).startswith("fe80")):
|
||||
ipv6 = addr["addr"] + "/" + str(addr["prefix"])
|
||||
ipv6.append(addr["addr"] + "/" + str(addr["prefix"]))
|
||||
return ipv4, ipv6
|
||||
|
||||
def extract_lease(info):
|
||||
ipv4 = None
|
||||
ipv6 = None
|
||||
ipv4 = []
|
||||
ipv6 = []
|
||||
if info["mac"] == iface_mac:
|
||||
if info["type"] == 0:
|
||||
ipv4 = info["ipaddr"]
|
||||
ipv4.append(info["ipaddr"])
|
||||
elif info["type"] == 1:
|
||||
ipv6 = info["ipaddr"]
|
||||
ipv6.append(info["ipaddr"])
|
||||
return ipv4, ipv6
|
||||
|
||||
for ips in ([qemuga] + leases + [arp]):
|
||||
|
|
Loading…
Reference in a new issue