mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
connection.py getting networking format information function
This commit is contained in:
parent
69bc58d94f
commit
33407719b6
3 changed files with 27 additions and 57 deletions
|
@ -1,11 +1,11 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<a href="#AddInboundQos" type="button" class="btn btn-success pull-right" data-toggle="modal" title="add inbound qos">
|
<a href="#AddQos" type="button" class="btn btn-sm btn-success pull-right" data-toggle="modal" title="add qos">
|
||||||
<span class="glyphicon glyphicon-arrow-down" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- Modal pool -->
|
<!-- Modal pool -->
|
||||||
<div class="modal fade" id="AddInboundQos" tabindex="-1" role="dialog" aria-labelledby="AddInboundQosLabel"
|
<div class="modal fade" id="AddQos" tabindex="-1" role="dialog" aria-labelledby="AddQosLabel"
|
||||||
aria-hidden="true">
|
aria-hidden="true">
|
||||||
<div class="modal-dialog">
|
<div class="modal-dialog">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
@ -13,29 +13,39 @@
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
<h4 class="modal-title">{% trans "Add Inbound Qos for Network" %}</h4>
|
<h4 class="modal-title">{% trans "Add Inbound Qos for Network" %}</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form class="form-horizontal" method="post" name="set_qos" role="form">{% csrf_token %}
|
<form class="form-horizontal" method="post" name="set_qos" role="form">{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">{% trans "Direction" %}:</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select class="form-control" name="qos_direction">
|
||||||
|
<option value="inbound">{% trans 'Inbound' %}</option>
|
||||||
|
<option value="outbound">{% trans 'Outbound' %}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Average" %}:</label>
|
<label class="col-sm-4 control-label">{% trans "Average" %}:</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input class="form-control" name="qos_inbound_average" required pattern="[0-9]+"/>
|
<input class="form-control" name="qos_inbound_average" placeholder="kilobytes"
|
||||||
|
required pattern="[0-9]+"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Peak" %}:</label>
|
<label class="col-sm-4 control-label">{% trans "Peak" %}:</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input class="form-control" name="qos_inbound_peak"
|
<input class="form-control" name="qos_inbound_peak" placeholder="kilobytes"
|
||||||
required pattern="[0-9]+"/>
|
required pattern="[0-9]+"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-4 control-label">{% trans "Burst" %}:</label>
|
<label class="col-sm-4 control-label">{% trans "Burst" %}:</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input class="form-control" name="qos_inbound_burst" required pattern="[0-9]+"/>
|
<input class="form-control" name="qos_inbound_burst" placeholder="kilobytes"
|
||||||
|
required pattern="[0-9]+"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input name="qos_direction" value="inbound" hidden/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
|
@ -1,49 +0,0 @@
|
||||||
{% load i18n %}
|
|
||||||
{% if request.user.is_superuser %}
|
|
||||||
<a href="#AddOutboundQos" type="button" class="btn btn-success pull-right" data-toggle="modal" title="add outbound qos">
|
|
||||||
<span class="glyphicon glyphicon-arrow-up" aria-hidden="true"></span>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<!-- Modal pool -->
|
|
||||||
<div class="modal fade" id="AddOutboundQos" tabindex="-1" role="dialog" aria-labelledby="AddOutboundQosLabel"
|
|
||||||
aria-hidden="true">
|
|
||||||
<div class="modal-dialog">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
||||||
<h4 class="modal-title">{% trans "Add Outbound Qos for Network" %}</h4>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-body">
|
|
||||||
<form class="form-horizontal" method="post" name="set_qos" role="form">{% csrf_token %}
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-4 control-label">{% trans "Average" %}:</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input class="form-control" name="qos_outbound_average" required pattern="[0-9]+"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-4 control-label">{% trans "Peak" %}:</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input class="form-control" name="qos_outbound_peak"
|
|
||||||
required pattern="[0-9]+"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-sm-4 control-label">{% trans "Burst" %}:</label>
|
|
||||||
<div class="col-sm-6">
|
|
||||||
<input class="form-control" name="qos_outbound_burst" required pattern="[0-9]+"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input name="qos_direction" value="outbound" hidden/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">{% trans 'Close' %}</button>
|
|
||||||
<button type="submit" class="btn btn-primary" name="set_qos">{% trans 'Save' %}</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div> <!-- /.modal-dialog -->
|
|
||||||
</div> <!-- /.modal -->
|
|
||||||
{% endif %}
|
|
|
@ -508,6 +508,15 @@ class wvmConnect(object):
|
||||||
def get_network(self, net):
|
def get_network(self, net):
|
||||||
return self.wvm.networkLookupByName(net)
|
return self.wvm.networkLookupByName(net)
|
||||||
|
|
||||||
|
def get_network_forward(self, net_name):
|
||||||
|
def get_forward(doc):
|
||||||
|
forward_mode = util.get_xpath(doc, '/network/forward/@mode')
|
||||||
|
return forward_mode or 'isolated'
|
||||||
|
|
||||||
|
net = self.get_network(net_name)
|
||||||
|
xml = net.XMLDesc(0)
|
||||||
|
return util.get_xml_path(xml, func=get_forward)
|
||||||
|
|
||||||
def get_nwfilter(self, name):
|
def get_nwfilter(self, name):
|
||||||
return self.wvm.nwfilterLookupByName(name)
|
return self.wvm.nwfilterLookupByName(name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue