mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-12-24 06:56:42 +00:00
Return the platform of a compute
Ref https://github.com/GNS3/gns3-gui/issues/1550
This commit is contained in:
parent
2b9c190bcf
commit
4b4053dc2b
@ -15,6 +15,8 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
from gns3server.web.route import Route
|
from gns3server.web.route import Route
|
||||||
from gns3server.config import Config
|
from gns3server.config import Config
|
||||||
from gns3server.schemas.capabilities import CAPABILITIES_SCHEMA
|
from gns3server.schemas.capabilities import CAPABILITIES_SCHEMA
|
||||||
@ -37,5 +39,6 @@ class CapabilitiesHandler:
|
|||||||
|
|
||||||
response.json({
|
response.json({
|
||||||
"version": __version__,
|
"version": __version__,
|
||||||
|
"platform": sys.platform,
|
||||||
"node_types": node_types
|
"node_types": node_types
|
||||||
})
|
})
|
||||||
|
@ -30,7 +30,12 @@ CAPABILITIES_SCHEMA = {
|
|||||||
},
|
},
|
||||||
"node_types": {
|
"node_types": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": NODE_TYPE_SCHEMA
|
"items": NODE_TYPE_SCHEMA,
|
||||||
|
"description": "Node type supported by the compute"
|
||||||
|
},
|
||||||
|
"platform": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Platform where the compute is running"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": False
|
"additionalProperties": False
|
||||||
|
@ -26,6 +26,7 @@ from gns3server.config import Config
|
|||||||
|
|
||||||
from gns3server.version import __version__
|
from gns3server.version import __version__
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_get(http_compute, windows_platform):
|
def test_get(http_compute, windows_platform):
|
||||||
"""
|
"""
|
||||||
@ -33,11 +34,11 @@ def test_get(http_compute, windows_platform):
|
|||||||
"""
|
"""
|
||||||
response = http_compute.get('/capabilities', example=True)
|
response = http_compute.get('/capabilities', example=True)
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json == {'node_types': ['cloud', 'ethernet_hub', 'ethernet_switch', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__}
|
assert response.json == {'node_types': ['cloud', 'ethernet_hub', 'ethernet_switch', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__, 'platform': sys.platform}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
|
||||||
def test_get_on_gns3vm(http_compute, on_gns3vm):
|
def test_get_on_gns3vm(http_compute, on_gns3vm):
|
||||||
response = http_compute.get('/capabilities', example=True)
|
response = http_compute.get('/capabilities', example=True)
|
||||||
assert response.status == 200
|
assert response.status == 200
|
||||||
assert response.json == {'node_types': ['cloud', 'ethernet_hub', 'ethernet_switch', 'nat', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__}
|
assert response.json == {'node_types': ['cloud', 'ethernet_hub', 'ethernet_switch', 'nat', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__, 'platform': sys.platform}
|
||||||
|
Loading…
Reference in New Issue
Block a user