diff --git a/gns3server/controller/project.py b/gns3server/controller/project.py
index fd2e4f47..f82224dd 100644
--- a/gns3server/controller/project.py
+++ b/gns3server/controller/project.py
@@ -93,6 +93,13 @@ class Project:
except KeyError:
raise aiohttp.web.HTTPNotFound(text="VM ID {} doesn't exist".format(vm_id))
+ @property
+ def vms(self):
+ """
+ :returns: Dictionnary of the VMS
+ """
+ return self._vms
+
@asyncio.coroutine
def addLink(self):
"""
@@ -111,6 +118,13 @@ class Project:
except KeyError:
raise aiohttp.web.HTTPNotFound(text="Link ID {} doesn't exist".format(link_id))
+ @property
+ def links(self):
+ """
+ :returns: Dictionnary of the Links
+ """
+ return self._links
+
@asyncio.coroutine
def close(self):
for hypervisor in self._hypervisors:
diff --git a/gns3server/controller/vm.py b/gns3server/controller/vm.py
index 1c90c956..767cdc79 100644
--- a/gns3server/controller/vm.py
+++ b/gns3server/controller/vm.py
@@ -52,6 +52,10 @@ class VM:
def id(self):
return self._id
+ @property
+ def name(self):
+ return self._name
+
@property
def vm_type(self):
return self._vm_type
@@ -76,6 +80,14 @@ class VM:
def hypervisor(self):
return self._hypervisor
+ @property
+ def host(self):
+ """
+ :returns: Domain or ip for console connection
+ """
+ return self._hypervisor.host
+
+
@asyncio.coroutine
def create(self):
data = copy.copy(self._properties)
diff --git a/gns3server/handlers/index_handler.py b/gns3server/handlers/index_handler.py
index 18b1696a..08489b13 100644
--- a/gns3server/handlers/index_handler.py
+++ b/gns3server/handlers/index_handler.py
@@ -16,6 +16,7 @@
from ..web.route import Route
+from ..controller import Controller
from ..hypervisor.port_manager import PortManager
from ..hypervisor.project_manager import ProjectManager
from ..version import __version__
@@ -33,14 +34,33 @@ class IndexHandler:
@classmethod
@Route.get(
- r"/status",
- description="Ressources used by GNS3Server"
+ r"/hypervisor",
+ description="Ressources used by GNS3 Hypervisor"
)
- def ports(request, response):
- response.template("status.html",
+ def hypervisor(request, response):
+ response.template("hypervisor.html",
port_manager=PortManager.instance(),
project_manager=ProjectManager.instance()
)
+ @classmethod
+ @Route.get(
+ r"/controller",
+ description="Ressources used by GNS3 Controller"
+ )
+ def controller(request, response):
+ response.template("controller.html",
+ controller=Controller.instance()
+ )
+
+ @classmethod
+ @Route.get(
+ r"/projects/{project_id}",
+ description="Ressources used by GNS3 Controller"
+ )
+ def project(request, response):
+ controller = Controller.instance()
+ response.template("project.html",
+ project=controller.getProject(request.match_info["project_id"]))
@classmethod
@Route.get(
diff --git a/gns3server/templates/controller.html b/gns3server/templates/controller.html
new file mode 100644
index 00000000..f6619c69
--- /dev/null
+++ b/gns3server/templates/controller.html
@@ -0,0 +1,41 @@
+{% extends "layout.html" %}
+{% block body %}
+
+ Controller status
+
+The purpose of this page is to help for GNS3 debug. This can be dropped
+in futur GNS3 versions.
+
+Opened projects
+
+
+ Name |
+ ID
+ | VMs |
+ Links |
+
+{% for project in controller.projects.values() %}
+
+ {{project.name}} |
+ {{project.id}} |
+ {{project.vms|length}} |
+ {{project.links|length}} |
+
+{% endfor %}
+
+
+Hypervisors
+
+
+ ID
+ |
+{% for hypervisor in controller.hypervisors.values() %}
+
+ {{hypervisor.id}} |
+
+{% endfor %}
+
+
+
+{%endblock%}
+
diff --git a/gns3server/templates/status.html b/gns3server/templates/hypervisor.html
similarity index 88%
rename from gns3server/templates/status.html
rename to gns3server/templates/hypervisor.html
index bed8c797..935f8f3d 100644
--- a/gns3server/templates/status.html
+++ b/gns3server/templates/hypervisor.html
@@ -3,7 +3,8 @@
Server status
-The purpose of this page is to help for GNS3 debug.
+The purpose of this page is to help for GNS3 debug. This can be dropped
+in futur GNS3 versions.
Opened projects
diff --git a/gns3server/templates/layout.html b/gns3server/templates/layout.html
index 54caef09..2873ffe4 100644
--- a/gns3server/templates/layout.html
+++ b/gns3server/templates/layout.html
@@ -16,7 +16,9 @@
|
Backup projects
|
- Status
+ Controller status
+ |
+ Hypervisor status
{% block body %}{% endblock %}