mirror of https://github.com/GNS3/gns3-server
parent
210aa6f12a
commit
f7cd09d5fb
@ -1,9 +1,19 @@
|
||||
__all__ = ["version_handler",
|
||||
"network_handler",
|
||||
"vpcs_handler",
|
||||
"project_handler",
|
||||
"virtualbox_handler",
|
||||
"dynamips_vm_handler",
|
||||
"dynamips_device_handler",
|
||||
"iou_handler",
|
||||
"qemu_handler"]
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from gns3server.handlers.api import *
|
||||
from gns3server.handlers.upload_handler import UploadHandler
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
__all__ = ["version_handler",
|
||||
"network_handler",
|
||||
"vpcs_handler",
|
||||
"project_handler",
|
||||
"virtualbox_handler",
|
||||
"dynamips_vm_handler",
|
||||
"dynamips_device_handler",
|
||||
"iou_handler",
|
||||
"qemu_handler"]
|
@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from ..web.route import Route
|
||||
from ..schemas.version import VERSION_SCHEMA
|
||||
from ..version import __version__
|
||||
from aiohttp.web import HTTPConflict
|
||||
|
||||
|
||||
class UploadHandler:
|
||||
|
||||
@classmethod
|
||||
@Route.get(
|
||||
r"/upload",
|
||||
description="Manage upload of GNS3 images",
|
||||
api_version=None
|
||||
)
|
||||
def index(request, response):
|
||||
response.template("upload.html")
|
||||
|
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>GNS3 Server</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
<small>
|
||||
Powered by GNS3 {{gns3_version}}
|
||||
</small>
|
||||
</html>
|
@ -1,20 +1,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<title>Upload Form for GNS3 server {{version}}</title>
|
||||
</head>
|
||||
<body>
|
||||
<p><h1>Select & Upload (v{{version}})</h1></p>
|
||||
<form enctype="multipart/form-data" action="/upload" method="post">
|
||||
File: <input type="file" name="file" />
|
||||
<br />
|
||||
<br />
|
||||
<input type="submit" value="upload" />
|
||||
</form>
|
||||
{%if items%}
|
||||
<h3>Files on {{host}}</h3>
|
||||
{%for item in items%}
|
||||
<p>{{path}}/{{item}}</a></p>
|
||||
{%end%}
|
||||
{%end%}
|
||||
</body>
|
||||
{% extends "layout.html" %}
|
||||
{% block body %}
|
||||
<h1>Select & Upload an image for GNS3</h1>
|
||||
<form enctype="multipart/form-data" action="/upload" method="post">
|
||||
File: <input type="file" name="file" />
|
||||
<br />
|
||||
<br />
|
||||
<input type="submit" value="Upload" />
|
||||
</form>
|
||||
{%if items%}
|
||||
<h3>Files on {{host}}</h3>
|
||||
{%for item in items%}
|
||||
<p>{{path}}/{{item}}</a></p>
|
||||
{%endfor%}
|
||||
{%endif%}
|
||||
{% endblock %}
|
||||
|
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
This test suite check /version endpoint
|
||||
It's also used for unittest the HTTP implementation.
|
||||
"""
|
||||
|
||||
from gns3server.version import __version__
|
||||
|
||||
|
||||
def test_version_index_upload(server):
|
||||
response = server.get('/upload', api_version=None)
|
||||
assert response.status == 200
|
||||
html = response.html
|
||||
assert "GNS3 Server" in html
|
||||
assert "Select & Upload" in html
|
Loading…
Reference in new issue