mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-01 04:38:12 +00:00
A debug status page embed in the server
This commit is contained in:
parent
480ca037cd
commit
286cd7a3ac
@ -15,6 +15,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ..web.route import Route
|
||||
from ..modules.port_manager import PortManager
|
||||
from ..modules.project_manager import ProjectManager
|
||||
|
||||
|
||||
class IndexHandler:
|
||||
@ -27,3 +29,15 @@ class IndexHandler:
|
||||
)
|
||||
def index(request, response):
|
||||
response.template("index.html")
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/status",
|
||||
description="Ressources used by GNS3Server",
|
||||
api_version=None
|
||||
)
|
||||
def ports(request, response):
|
||||
response.template("status.html",
|
||||
port_manager=PortManager.instance(),
|
||||
project_manager=ProjectManager.instance()
|
||||
)
|
||||
|
@ -15,6 +15,8 @@
|
||||
<a href="/backup/images.tar">Backup images</a>
|
||||
|
|
||||
<a href="/backup/projects.tar">Backup projects</a>
|
||||
|
|
||||
<a href="/backup/projects.tar">Status</a>
|
||||
</div>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
|
29
gns3server/templates/status.html
Normal file
29
gns3server/templates/status.html
Normal file
@ -0,0 +1,29 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<h1>
|
||||
Server status
|
||||
</h1>
|
||||
The purpose of this page is to help for GNS3 debug.
|
||||
|
||||
<h2>Opened projects</h2>
|
||||
<ul>
|
||||
{% for project in project_manager.projects %}
|
||||
<li>{{project.name}} ({{project.id}})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h2>Ports reserved by GNS3</h2>
|
||||
<h3>TCP</h3>
|
||||
<ul>
|
||||
{% for port in port_manager.tcp_ports %}
|
||||
<li>{{port}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>UDP</h3>
|
||||
<ul>
|
||||
{% for port in port_manager.udp_ports %}
|
||||
<li>{{port}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
@ -29,3 +29,8 @@ def test_index(server):
|
||||
html = response.html
|
||||
assert "Website" in html
|
||||
assert __version__ in html
|
||||
|
||||
|
||||
def test_status(server):
|
||||
response = server.get('/status', api_version=None)
|
||||
assert response.status == 200
|
||||
|
Loading…
Reference in New Issue
Block a user