mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-13 18:35:15 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
469bd692a0 | ||
|
|
d34c3a0ac7 | ||
|
|
fb3409c1a1 | ||
|
|
08693871ae | ||
|
|
f5ea20347e | ||
|
|
ac4c5f5985 | ||
|
|
e17a79e261 | ||
|
|
4758431c76 | ||
|
|
b472f6dbf8 | ||
|
|
b39c7541fb | ||
|
|
82779d816f | ||
|
|
96c6805ace | ||
|
|
efb84b3063 | ||
|
|
0be45c7da2 | ||
|
|
a4222b4d03 | ||
|
|
5f75fc7573 | ||
|
|
5269d4386c | ||
|
|
9d6cea665a | ||
|
|
8b57fbaa0a | ||
|
|
d4a9a21af9 | ||
|
|
8a900588ca | ||
|
|
8ed1fa6ad5 | ||
|
|
a689a55937 | ||
|
|
1c0b0ae423 | ||
|
|
ad7813d04b | ||
|
|
654b84cb7b | ||
|
|
fc1acc58de | ||
|
|
07ac4f5834 | ||
|
|
249bf89b7e | ||
|
|
efc3ff62b5 | ||
|
|
a521e61efc | ||
|
|
9492fd0671 | ||
|
|
512407939d | ||
|
|
685bf88005 | ||
|
|
a1090a3da8 | ||
|
|
c8e5b41f39 | ||
|
|
94b5d3e636 | ||
|
|
d54e6babe2 | ||
|
|
a9b7869e04 | ||
|
|
72838a8108 | ||
|
|
7229707746 | ||
|
|
c9694a4e1d | ||
|
|
a792792128 | ||
|
|
eca502c49c | ||
|
|
0ee73605c0 | ||
|
|
648ae231ef | ||
|
|
0dd53d3178 | ||
|
|
09d67ec1a8 | ||
|
|
c820a807ad | ||
|
|
014d3f2ad9 | ||
|
|
5e1b8814b6 | ||
|
|
df56955bf0 | ||
|
|
b84bedffec | ||
|
|
423d3fd82b | ||
|
|
e1b4d74f1e | ||
|
|
86fbae00e1 | ||
|
|
f38efd311a | ||
|
|
91e9fa1cbc | ||
|
|
db067579db | ||
|
|
6314dd3c35 | ||
|
|
4e41aefbdb | ||
|
|
bbff6974e6 | ||
|
|
c05dcef54f | ||
|
|
b7d43b29cd | ||
|
|
cbaa563996 | ||
|
|
e94b55e3bf | ||
|
|
6c521b5f7a | ||
|
|
a8014da10b | ||
|
|
f6080013e3 | ||
|
|
fc54c6e496 | ||
|
|
04cd107651 | ||
|
|
19cabdfde6 | ||
|
|
af7fbe6bb4 | ||
|
|
3d58b437b4 | ||
|
|
83921a45df | ||
|
|
1a6a729736 | ||
|
|
77c356c82c | ||
|
|
b4819b5500 | ||
|
|
11a9451098 |
No files matched your search
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: ["ubuntu-latest"]
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
|
||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||
#include:
|
||||
# only test with Python 3.10 on Windows
|
||||
# - os: windows-latest
|
||||
|
||||
@@ -1,5 +1,42 @@
|
||||
# Change Log
|
||||
|
||||
## 3.0.2 03/01/2025
|
||||
|
||||
* Bundle web-ui v3.0.2
|
||||
* Support to create templates based on image checksums.
|
||||
* Improvements for installing built-in disks.
|
||||
* Use watchdog instead of watchfiles to monitor for new images on the file system
|
||||
* Drop Python 3.8
|
||||
* Replace python-jose library by joserfc
|
||||
* Upgrade dependencies
|
||||
* Remove blocking IOU phone home call.
|
||||
|
||||
## 3.0.1 27/12/2024
|
||||
|
||||
* Bundle web-ui v3.0.1
|
||||
* Allow for upgrading built-in disks
|
||||
* Fix config parsing when configuring server protocol. Fixes https://github.com/GNS3/gns3-gui/issues/3681
|
||||
* Update empty Qemu disks with correct MD5 checksums
|
||||
* Increase timeout to run compute HTTP queries. Fixes #3453
|
||||
|
||||
## 3.0.0 20/12/2024
|
||||
|
||||
* Bundle web-ui v3.0.0
|
||||
* Use static favicon for API docs. Ref #3674
|
||||
* Configure self-hosting JavaScript and CSS for docs
|
||||
* Fix project auto open feature. Fixes #2455
|
||||
* Store IOU licence in the secrets directory and disable the check by default
|
||||
* Require "Project.Audit" permission to duplicate a project and check if "Project.Allocate" permission for the destination.
|
||||
|
||||
## 2.2.52 02/12/2024
|
||||
|
||||
* Bundle web-ui v2.2.52
|
||||
* Sync appliances
|
||||
* Remove restrictions based on file extension when listing images and fix ELF header checks
|
||||
* Fix use project name instead of ID for fast duplication when running local server. Fixes #2446
|
||||
* Overwrite user resources when the originals have changed.
|
||||
* Relax setuptools requirement to allow for easier Debian packaging on Ubuntu Focal & Jammy
|
||||
|
||||
## 3.0.0rc2 20/11/2024
|
||||
|
||||
* Bundle web-ui v3.0.0rc2
|
||||
|
||||
@@ -27,11 +27,11 @@ from fastapi.encoders import jsonable_encoder
|
||||
from starlette.requests import ClientDisconnect
|
||||
from sqlalchemy.orm.exc import MultipleResultsFound
|
||||
from typing import List, Optional
|
||||
from gns3server import schemas
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.config import Config
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.utils.images import InvalidImageError, write_image, read_image_info, default_images_directory
|
||||
from gns3server.utils.images import InvalidImageError, write_image, read_image_info, default_images_directory, get_builtin_disks
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
@@ -51,7 +51,6 @@ log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post(
|
||||
"/qemu/{image_path:path}",
|
||||
response_model=schemas.Image,
|
||||
@@ -175,6 +174,61 @@ async def upload_image(
|
||||
return image
|
||||
|
||||
|
||||
@router.delete(
|
||||
"/prune",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
dependencies=[Depends(has_privilege("Image.Allocate"))]
|
||||
)
|
||||
async def prune_images(
|
||||
images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)),
|
||||
) -> None:
|
||||
"""
|
||||
Prune images not attached to any template.
|
||||
|
||||
Required privilege: Image.Allocate
|
||||
"""
|
||||
|
||||
skip_images = get_builtin_disks()
|
||||
await images_repo.prune_images(skip_images)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/install",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
dependencies=[Depends(has_privilege("Image.Allocate"))]
|
||||
)
|
||||
async def install_images(
|
||||
images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)),
|
||||
templates_repo: TemplatesRepository = Depends(get_repository(TemplatesRepository))
|
||||
) -> None:
|
||||
"""
|
||||
Attempt to automatically create templates based on image checksums.
|
||||
|
||||
Required privilege: Image.Allocate
|
||||
"""
|
||||
|
||||
skip_images = get_builtin_disks()
|
||||
images = await images_repo.get_images()
|
||||
for image in images:
|
||||
if skip_images and image.filename in skip_images:
|
||||
log.debug(f"Skipping image '{image.path}' for image installation")
|
||||
continue
|
||||
templates = await images_repo.get_image_templates(image.image_id)
|
||||
if templates:
|
||||
# the image is already used by a template
|
||||
log.warning(f"Image '{image.path}' is used by one or more templates")
|
||||
continue
|
||||
await Controller.instance().appliance_manager.install_appliances_from_image(
|
||||
image.path,
|
||||
image.checksum,
|
||||
images_repo,
|
||||
templates_repo,
|
||||
None,
|
||||
None,
|
||||
os.path.dirname(image.path)
|
||||
)
|
||||
|
||||
|
||||
@router.get(
|
||||
"/{image_path:path}",
|
||||
response_model=schemas.Image,
|
||||
@@ -218,7 +272,7 @@ async def delete_image(
|
||||
image = await images_repo.get_image(image_path)
|
||||
except MultipleResultsFound:
|
||||
raise ControllerBadRequestError(f"Image '{image_path}' matches multiple images. "
|
||||
f"Please include the relative path of the image")
|
||||
f"Please include the absolute path of the image")
|
||||
|
||||
if not image:
|
||||
raise ControllerNotFoundError(f"Image '{image_path}' not found")
|
||||
@@ -236,20 +290,3 @@ async def delete_image(
|
||||
success = await images_repo.delete_image(image_path)
|
||||
if not success:
|
||||
raise ControllerError(f"Image '{image_path}' could not be deleted")
|
||||
|
||||
|
||||
@router.post(
|
||||
"/prune",
|
||||
status_code=status.HTTP_204_NO_CONTENT,
|
||||
dependencies=[Depends(has_privilege("Image.Allocate"))]
|
||||
)
|
||||
async def prune_images(
|
||||
images_repo: ImagesRepository = Depends(get_repository(ImagesRepository)),
|
||||
) -> None:
|
||||
"""
|
||||
Prune images not attached to any template.
|
||||
|
||||
Required privilege: Image.Allocate
|
||||
"""
|
||||
|
||||
await images_repo.prune_images()
|
||||
@@ -426,26 +426,42 @@ async def import_project(
|
||||
status_code=status.HTTP_201_CREATED,
|
||||
response_model=schemas.Project,
|
||||
responses={**responses, 409: {"model": schemas.ErrorMessage, "description": "Could not duplicate project"}},
|
||||
dependencies=[Depends(has_privilege("Project.Allocate"))]
|
||||
dependencies=[Depends(has_privilege("Project.Audit"))]
|
||||
)
|
||||
async def duplicate_project(
|
||||
project_data: schemas.ProjectDuplicate,
|
||||
project: Project = Depends(dep_project),
|
||||
current_user: schemas.User = Depends(get_current_active_user),
|
||||
rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)),
|
||||
pools_repo: ResourcePoolsRepository = Depends(get_repository(ResourcePoolsRepository))
|
||||
) -> schemas.Project:
|
||||
"""
|
||||
Duplicate a project.
|
||||
|
||||
Required privilege: Project.Allocate
|
||||
Required privilege: Project.Audit
|
||||
"""
|
||||
|
||||
pool_memberships = await pools_repo.get_resource_memberships(project.id)
|
||||
|
||||
# check if the project can be duplicated somewhere (either in a pool or in the root)
|
||||
if not current_user.is_superadmin:
|
||||
can_be_duplicated_somewhere = False
|
||||
if pool_memberships:
|
||||
for pool in pool_memberships:
|
||||
if await rbac_repo.check_user_has_privilege(current_user.user_id, f"/pools/{pool.resource_pool_id}", "Project.Allocate"):
|
||||
can_be_duplicated_somewhere = True
|
||||
break
|
||||
|
||||
if not can_be_duplicated_somewhere and not await rbac_repo.check_user_has_privilege(current_user.user_id, "/projects", "Project.Allocate"):
|
||||
log.warning(f"Project {project.name} cannot be duplicated anywhere")
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
reset_mac_addresses = project_data.reset_mac_addresses
|
||||
new_project = await project.duplicate(
|
||||
name=project_data.name, reset_mac_addresses=reset_mac_addresses
|
||||
)
|
||||
|
||||
# Add the new project in the same resource pools if the duplicated project is in any
|
||||
pool_memberships = await pools_repo.get_resource_memberships(project.id)
|
||||
# Add the new project in the same resource pools if the duplicated project belongs to any
|
||||
if pool_memberships:
|
||||
resource_create = schemas.ResourceCreate(resource_id=new_project.id, resource_type="project", name=new_project.name)
|
||||
resource = await pools_repo.create_resource(resource_create)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
API routes for templates.
|
||||
"""
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
@@ -34,6 +35,8 @@ from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.services.templates import TemplatesService
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.controller.controller_error import ControllerError
|
||||
from gns3server.utils.images import get_builtin_disks
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.rbac import has_privilege
|
||||
@@ -132,10 +135,28 @@ async def delete_template(
|
||||
Required privilege: Template.Allocate
|
||||
"""
|
||||
|
||||
images = await templates_repo.get_template_images(template_id)
|
||||
await TemplatesService(templates_repo).delete_template(template_id)
|
||||
await rbac_repo.delete_all_ace_starting_with_path(f"/templates/{template_id}")
|
||||
if prune_images:
|
||||
await images_repo.prune_images()
|
||||
if prune_images and images:
|
||||
skip_images = get_builtin_disks()
|
||||
for image in images:
|
||||
if image.filename in skip_images:
|
||||
continue
|
||||
templates = await images_repo.get_image_templates(image.image_id)
|
||||
if templates:
|
||||
template_names = ", ".join([template.name for template in templates])
|
||||
raise ControllerError(f"Image '{image.path}' is used by one or more templates: {template_names}")
|
||||
|
||||
try:
|
||||
os.remove(image.path)
|
||||
except OSError:
|
||||
log.warning(f"Could not delete image file {image.path}")
|
||||
|
||||
print(f"Deleting image '{image.path}'")
|
||||
success = await images_repo.delete_image(image.path)
|
||||
if not success:
|
||||
raise ControllerError(f"Image '{image.path}' could not removed from the database")
|
||||
|
||||
|
||||
@router.get(
|
||||
|
||||
@@ -27,20 +27,20 @@ router = APIRouter()
|
||||
templates = Jinja2Templates(directory=os.path.join("gns3server", "templates"))
|
||||
|
||||
|
||||
@router.get("/")
|
||||
@router.get("/", include_in_schema=False)
|
||||
async def root():
|
||||
|
||||
return RedirectResponse("/static/web-ui/bundled", status_code=308) # permanent redirect
|
||||
|
||||
|
||||
@router.get("/debug", response_class=HTMLResponse, deprecated=True)
|
||||
@router.get("/debug", response_class=HTMLResponse, deprecated=True, include_in_schema=False)
|
||||
def debug(request: Request):
|
||||
|
||||
kwargs = {"request": request, "gns3_version": __version__, "gns3_host": request.client.host}
|
||||
return templates.TemplateResponse("index.html", kwargs)
|
||||
|
||||
|
||||
@router.get("/static/web-ui/{file_path:path}", description="Web user interface")
|
||||
@router.get("/static/web-ui/{file_path:path}", description="Web user interface", include_in_schema=False)
|
||||
async def web_ui(file_path: str):
|
||||
|
||||
file_path = os.path.normpath(file_path).strip("/")
|
||||
|
||||
@@ -19,15 +19,20 @@
|
||||
FastAPI app
|
||||
"""
|
||||
|
||||
import time
|
||||
|
||||
from fastapi import FastAPI, Request, HTTPException, status
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from uvicorn.main import Server as UvicornServer
|
||||
|
||||
from fastapi.openapi.docs import (
|
||||
get_redoc_html,
|
||||
get_swagger_ui_html,
|
||||
get_swagger_ui_oauth2_redirect_html,
|
||||
)
|
||||
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerNotFoundError,
|
||||
@@ -51,7 +56,11 @@ log = logging.getLogger(__name__)
|
||||
def get_application() -> FastAPI:
|
||||
|
||||
application = FastAPI(
|
||||
title="GNS3 controller API", description="This page describes the public controller API for GNS3", version="v3"
|
||||
title="GNS3 controller API",
|
||||
description="This page describes the public controller API for GNS3",
|
||||
version="v3",
|
||||
docs_url=None,
|
||||
redoc_url=None
|
||||
)
|
||||
|
||||
application.add_middleware(
|
||||
@@ -66,6 +75,7 @@ def get_application() -> FastAPI:
|
||||
application.add_event_handler("shutdown", tasks.create_shutdown_handler(application))
|
||||
application.include_router(index.router, tags=["Index"])
|
||||
application.include_router(controller.router, prefix="/v3")
|
||||
application.mount("/static", StaticFiles(packages=[('gns3server', 'static')]), name="static")
|
||||
application.mount("/v3/compute", compute_api, name="compute")
|
||||
|
||||
return application
|
||||
@@ -85,6 +95,31 @@ def handle_exit(*args, **kwargs):
|
||||
|
||||
UvicornServer.handle_exit = handle_exit
|
||||
|
||||
# Configure self-hosting JavaScript and CSS for docs
|
||||
@app.get("/docs", include_in_schema=False)
|
||||
async def custom_swagger_ui_html():
|
||||
return get_swagger_ui_html(
|
||||
openapi_url=app.openapi_url,
|
||||
title=app.title + " - Swagger UI",
|
||||
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url,
|
||||
swagger_js_url="/static/swagger-ui-bundle.js",
|
||||
swagger_css_url="/static/swagger-ui.css",
|
||||
swagger_favicon_url="/static/favicon.ico"
|
||||
)
|
||||
|
||||
@app.get(app.swagger_ui_oauth2_redirect_url, include_in_schema=False)
|
||||
async def swagger_ui_redirect():
|
||||
return get_swagger_ui_oauth2_redirect_html()
|
||||
|
||||
|
||||
@app.get("/redoc", include_in_schema=False)
|
||||
async def redoc_html():
|
||||
return get_redoc_html(
|
||||
openapi_url=app.openapi_url,
|
||||
title=app.title + " - ReDoc",
|
||||
redoc_js_url="/static/redoc.standalone.js",
|
||||
redoc_favicon_url="/static/favicon.ico"
|
||||
)
|
||||
|
||||
@app.exception_handler(ControllerError)
|
||||
async def controller_error_handler(request: Request, exc: ControllerError):
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
"appliance_id": "c90f3ff3-4ed2-4437-9afb-21232fa92015",
|
||||
"name": "Arista vEOS",
|
||||
"category": "multilayer_switch",
|
||||
"description": "Arista EOS\u00ae is the core of Arista cloud networking solutions for next-generation data centers and cloud networks. Cloud architectures built with Arista EOS scale to tens of thousands of compute and storage nodes with management and provisioning capabilities that work at scale. Through its programmability, EOS enables a set of software applications that deliver workflow automation, high availability, unprecedented network visibility and analytics and rapid integration with a wide range of third-party applications for virtualization, management, automation and orchestration services.\n\nArista Extensible Operating System (EOS) is a fully programmable and highly modular, Linux-based network operation system, using familiar industry standard CLI and runs a single binary software image across the Arista switching family. Architected for resiliency and programmability, EOS has a unique multi-process state sharing architecture that separates state information and packet forwarding from protocol processing and application logic.",
|
||||
"description": "Arista EOS is the core of Arista cloud networking solutions for next-generation data centers and cloud networks. Cloud architectures built with Arista EOS scale to tens of thousands of compute and storage nodes with management and provisioning capabilities that work at scale. Through its programmability, EOS enables a set of software applications that deliver workflow automation, high availability, unprecedented network visibility and analytics and rapid integration with a wide range of third-party applications for virtualization, management, automation and orchestration services.\n\nArista Extensible Operating System (EOS) is a fully programmable and highly modular, Linux-based network operation system, using familiar industry standard CLI and runs a single binary software image across the Arista switching family. Architected for resiliency and programmability, EOS has a unique multi-process state sharing architecture that separates state information and packet forwarding from protocol processing and application logic.",
|
||||
"vendor_name": "Arista",
|
||||
"vendor_url": "http://www.arista.com/",
|
||||
"documentation_url": "https://www.arista.com/assets/data/docs/Manuals/EOS-4.17.2F-Manual.pdf",
|
||||
"product_name": "vEOS",
|
||||
"product_url": "https://eos.arista.com/",
|
||||
"registry_version": 4,
|
||||
"status": "experimental",
|
||||
"status": "stable",
|
||||
"maintainer": "GNS3 Team",
|
||||
"maintainer_email": "developers@gns3.net",
|
||||
"usage": "The login is admin, with no password by default",
|
||||
@@ -29,87 +29,24 @@
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "vEOS64-lab-4.32.0F.vmdk",
|
||||
"version": "4.32.0F",
|
||||
"md5sum": "851771260bb18ad3e90fa6956f0c6161",
|
||||
"filesize": 591724544,
|
||||
"filename": "vEOS-lab-4.33.1F.qcow2",
|
||||
"version": "4.33.1F",
|
||||
"md5sum": "8f662409c0732ed9f682edce63601e8a",
|
||||
"filesize": 611909632,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS64-lab-4.31.3M.vmdk",
|
||||
"version": "4.31.3M",
|
||||
"md5sum": "7df107da137f4a4e752014d4f0e94cd3",
|
||||
"filesize": 577961984,
|
||||
"filename": "vEOS-lab-4.32.3M.qcow2",
|
||||
"version": "4.32.3M",
|
||||
"md5sum": "46fc46f5ed1da8752eed8396f08862f8",
|
||||
"filesize": 605683712,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS64-lab-4.30.6M.vmdk",
|
||||
"version": "4.30.6M",
|
||||
"md5sum": "19721aace820b9ebf6d7ae6524803cf5",
|
||||
"filesize": 553123840,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS64-lab-4.29.8M.vmdk",
|
||||
"version": "4.29.8M",
|
||||
"md5sum": "131888f74cd63a93894521d40eb4d0b6",
|
||||
"filesize": 548405248,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS64-lab-4.28.11M.vmdk",
|
||||
"version": "4.28.11M",
|
||||
"md5sum": "6cac0e7b04a74ee0dc358327a00accfd",
|
||||
"filesize": 513343488,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS64-lab-4.27.12M.vmdk",
|
||||
"version": "4.27.12M",
|
||||
"md5sum": "34c4f785c7fc054cda8754dd13c0d7c7",
|
||||
"filesize": 496697344,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.32.0F.vmdk",
|
||||
"version": "4.32.0F",
|
||||
"md5sum": "584b901a1249717504050e48f74fb8dd",
|
||||
"filesize": 591396864,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.31.3M.vmdk",
|
||||
"version": "4.31.3M",
|
||||
"md5sum": "a2e130697cdf8547006eebebde6eefca",
|
||||
"filesize": 590086144,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.30.6M.vmdk",
|
||||
"version": "4.30.6M",
|
||||
"md5sum": "a4467648bcfa7b19640af8a4ad3153c6",
|
||||
"filesize": 565968896,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.29.8M.vmdk",
|
||||
"version": "4.29.8M",
|
||||
"md5sum": "1952f6114a4376212c525db9ec8efd5f",
|
||||
"filesize": 558039040,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.28.11M.vmdk",
|
||||
"version": "4.28.11M",
|
||||
"md5sum": "5502df24dfc231c45afb33d6018c16d0",
|
||||
"filesize": 521338880,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.27.12M.vmdk",
|
||||
"version": "4.27.12M",
|
||||
"md5sum": "e08a97e7c1977993f947fedeb4c6ddd5",
|
||||
"filesize": 504299520,
|
||||
"filename": "vEOS-lab-4.31.6M.qcow2",
|
||||
"version": "4.31.6M",
|
||||
"md5sum": "7410110b77472f058322ec4681f8a356",
|
||||
"filesize": 590479360,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
@@ -118,459 +55,28 @@
|
||||
"md5sum": "8d7e754efebca1930a93a2587ff7606c",
|
||||
"filesize": 6291456,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.26.2F.vmdk",
|
||||
"version": "4.26.2F",
|
||||
"md5sum": "de8ce9750fddb63bd3f71bccfcd7651e",
|
||||
"filesize": 475332608,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.25.3M.vmdk",
|
||||
"version": "4.25.3M",
|
||||
"md5sum": "2f196969036b4d283e86f15118d59c26",
|
||||
"filesize": 451543040,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.24.3M.vmdk",
|
||||
"version": "4.24.3M",
|
||||
"md5sum": "0a28e44c7ce4a8965f24a4a463a89b7d",
|
||||
"filesize": 455213056,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.24.2.1F.vmdk",
|
||||
"version": "4.24.2.1F",
|
||||
"md5sum": "6bab8b59ce5230e243e56f4127448fc8",
|
||||
"filesize": 455213056,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.23.4.2M.vmdk",
|
||||
"version": "4.23.4.2M",
|
||||
"md5sum": "d21cbef4e39f1e783b13a926cb54a242",
|
||||
"filesize": 454295552,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.23.0.1F.vmdk",
|
||||
"version": "4.23.0.1F",
|
||||
"md5sum": "08d52154aa11a834aef9f42bbf29f977",
|
||||
"filesize": 439484416,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.22.2.1F.vmdk",
|
||||
"version": "4.22.2.1F",
|
||||
"md5sum": "2a425bf8efe569a2bdf0e328f240cd16",
|
||||
"filesize": 426377216,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.22.0F.vmdk",
|
||||
"version": "4.22.0F",
|
||||
"md5sum": "cfcc75c2b8176cfd819afcfd6799b74c",
|
||||
"filesize": 414121984,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.21.1.1F.vmdk",
|
||||
"version": "4.21.1F",
|
||||
"md5sum": "02bfb7e53781fd44ff02357f201586d9",
|
||||
"filesize": 358809600,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.20.10M-combined.vmdk",
|
||||
"version": "4.20.10M-combined",
|
||||
"md5sum": "d1f2d650f93dbf24e04fdd2c9d62bd62",
|
||||
"filesize": 334626816,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.20.1F.vmdk",
|
||||
"version": "4.20.1F",
|
||||
"md5sum": "aadb6f3dbff28317f68cb4c4502d0db8",
|
||||
"filesize": 662044672,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.19.10M-combined.vmdk",
|
||||
"version": "4.19.10M-combined",
|
||||
"md5sum": "103daa45c33be4584cbe6adc60de46a3",
|
||||
"filesize": 324141056,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.19.10M.vmdk",
|
||||
"version": "4.19.10M",
|
||||
"md5sum": "665ed14389411ae5f16ba0a2ff84240a",
|
||||
"filesize": 637337600,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.18.10M-combined.vmdk",
|
||||
"version": "4.18.10M-combined",
|
||||
"md5sum": "e33e0ef5b8cecc84c5bb57569b36b9c6",
|
||||
"filesize": 317652992,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.18.10M.vmdk",
|
||||
"version": "4.18.10M",
|
||||
"md5sum": "1d87e9ace37fe3706dbf3e49c8d4d231",
|
||||
"filesize": 624427008,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.18.5M.vmdk",
|
||||
"version": "4.18.5M",
|
||||
"md5sum": "b1ee6268dbaf2b2276fd7a5286c7ce2b",
|
||||
"filesize": 623116288,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.18.1F.vmdk",
|
||||
"version": "4.18.1F",
|
||||
"md5sum": "9648c63185f3b793b47528a858ca4364",
|
||||
"filesize": 620625920,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.17.8M.vmdk",
|
||||
"version": "4.17.8M",
|
||||
"md5sum": "afc79a06f930ea2cc0ae3e03cbfd3f23",
|
||||
"filesize": 608829440,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.17.2F.vmdk",
|
||||
"version": "4.17.2F",
|
||||
"md5sum": "3b4845edfa77cf9aaeb9c0a005d3e277",
|
||||
"filesize": 609615872,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.16.13M.vmdk",
|
||||
"version": "4.16.13M",
|
||||
"md5sum": "4d0facf90140fc3aab031f0f8f88a32f",
|
||||
"filesize": 521404416,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.16.6M.vmdk",
|
||||
"version": "4.16.6M",
|
||||
"md5sum": "b3f7b7cee17f2e66bb38b453a4939fef",
|
||||
"filesize": 519962624,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.15.10M.vmdk",
|
||||
"version": "4.15.10M",
|
||||
"md5sum": "98e08281a9c48ddf6f3c5d62a124a20f",
|
||||
"filesize": 517079040,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.15.5M.vmdk",
|
||||
"version": "4.15.5M",
|
||||
"md5sum": "cd74bb69c7ee905ac3d33c4d109f3ab7",
|
||||
"filesize": 516030464,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.14.14M.vmdk",
|
||||
"version": "4.14.14M",
|
||||
"md5sum": "d81ba0522f4d7838d96f7985e41cdc47",
|
||||
"filesize": 422641664,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.13.16M.vmdk",
|
||||
"version": "4.13.16M",
|
||||
"md5sum": "5763b2c043830c341c8b1009f4ea9a49",
|
||||
"filesize": 404684800,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "vEOS-lab-4.13.8M.vmdk",
|
||||
"version": "4.13.8M",
|
||||
"md5sum": "a47145b9e6e7a24171c0850f8755535e",
|
||||
"filesize": 409010176,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
},
|
||||
{
|
||||
"filename": "Aboot-veos-serial-8.0.0.iso",
|
||||
"version": "8.0.0",
|
||||
"md5sum": "488ad1c435d18c69bb8d69c7806457c9",
|
||||
"filesize": 5242880,
|
||||
"download_url": "https://www.arista.com/en/support/software-download"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "4.32.0F",
|
||||
"name": "4.33.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.32.0F.vmdk"
|
||||
"hdb_disk_image": "vEOS-lab-4.33.1F.qcow2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.31.3M",
|
||||
"name": "4.32.3M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.31.3M.vmdk"
|
||||
"hdb_disk_image": "vEOS-lab-4.32.3M.qcow2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.30.6M",
|
||||
"name": "4.31.6M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.30.6M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.29.8M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.29.8M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.28.11M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.28.11M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.27.12M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS64-lab-4.27.12M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.32.0F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.32.0F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.31.3M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.31.3M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.30.6M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.30.6M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.29.8M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.29.8M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.28.11M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.28.11M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.27.12M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.2.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.27.12M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.26.2F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.26.2F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.25.3M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.25.3M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.24.3M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.24.3M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.24.2.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.24.2.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.23.4.2M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.23.4.2M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.23.0.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.23.0.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.22.2.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.22.2.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.22.0F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.22.0F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.21.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.21.1.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.20.10M-combined",
|
||||
"images": {
|
||||
"hda_disk_image": "vEOS-lab-4.20.10M-combined.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.20.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.20.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.19.10M-combined",
|
||||
"images": {
|
||||
"hda_disk_image": "vEOS-lab-4.19.10M-combined.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.19.10M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.19.10M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.18.10M-combined",
|
||||
"images": {
|
||||
"hda_disk_image": "vEOS-lab-4.18.10M-combined.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.18.10M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.18.10M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.18.5M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.18.5M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.18.1F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.18.1F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.17.8M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.17.8M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.17.2F",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.17.2F.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.16.13M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.16.13M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.16.6M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.16.6M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.15.10M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.15.10M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.15.5M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.15.5M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.14.14M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.14.14M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.13.16M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.13.16M.vmdk"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "4.13.8M",
|
||||
"images": {
|
||||
"hda_disk_image": "Aboot-veos-serial-8.0.0.iso",
|
||||
"hdb_disk_image": "vEOS-lab-4.13.8M.vmdk"
|
||||
"hdb_disk_image": "vEOS-lab-4.31.6M.qcow2"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -33,11 +33,23 @@
|
||||
"md5sum": "cbbbea66a253f1dac0fcf81274dc778d",
|
||||
"filesize": 87756936
|
||||
},
|
||||
{
|
||||
"filename": "c7200-adventerprisek9-mz.152-4.M11.image",
|
||||
"version": "152-4.M11",
|
||||
"md5sum": "9a2005ad09ce1ec6fe7cf9af1e9b099e",
|
||||
"filesize": 128487680
|
||||
},
|
||||
{
|
||||
"filename": "c7200-adventerprisek9-mz.124-24.T5.image",
|
||||
"version": "124-24.T5",
|
||||
"md5sum": "6b89d0d804e1f2bb5b8bda66b5692047",
|
||||
"filesize": 102345240
|
||||
},
|
||||
{
|
||||
"filename": "c7200-a3jk9s-mz.124-25g.image",
|
||||
"version": "124-25G",
|
||||
"md5sum": "9c7cc9b3f3b3571411a7f62faaa2c036",
|
||||
"filesize": 71528984
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
@@ -55,12 +67,26 @@
|
||||
"image": "c7200-advipservicesk9-mz.152-4.S5.image"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "152-4.M11",
|
||||
"idlepc": "0x6062e5c0",
|
||||
"images": {
|
||||
"image": "c7200-adventerprisek9-mz.152-4.M11.image"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "124-24.T5",
|
||||
"idlepc": "0x606df838",
|
||||
"images": {
|
||||
"image": "c7200-adventerprisek9-mz.124-24.T5.image"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "124-25G",
|
||||
"idlepc": "0x6066a998",
|
||||
"images": {
|
||||
"image": "c7200-a3jk9s-mz.124-25g.image"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
"status": "stable",
|
||||
"maintainer": "GNS3 Team",
|
||||
"maintainer_email": "developers@gns3.net",
|
||||
"usage": "There is no default password and enable password. A default configuration is present. ASAv goes through a double-boot before becoming active. This is normal and expected.",
|
||||
"usage": "There is no default password and enable password. A default configuration is present. ASAv goes through a double-boot before becoming active. This is normal and expected. Switch to the Telnet console type after the first boot.",
|
||||
"symbol": ":/symbols/asa.svg",
|
||||
"first_port_name": "Management0/0",
|
||||
"port_name_format": "Gi0/{0}",
|
||||
@@ -26,6 +26,13 @@
|
||||
"kvm": "require"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "asav9-22-1-1.qcow2",
|
||||
"version": "9.22.1.1 CML",
|
||||
"md5sum": "250a924cdc2370208eaac9d1dc8dc9e3",
|
||||
"filesize": 379518976,
|
||||
"download_url": "https://learningnetworkstore.cisco.com/cisco-modeling-labs-personal/cisco-modeling-labs-personal/CML-PERSONAL.html"
|
||||
},
|
||||
{
|
||||
"filename": "asav9-18-2.qcow2",
|
||||
"version": "9.18.2 CML",
|
||||
@@ -126,6 +133,12 @@
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "9.22.1.1 CML",
|
||||
"images": {
|
||||
"hda_disk_image": "asav9-22-1-1.qcow2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "9.18.2 CML",
|
||||
"images": {
|
||||
|
||||
@@ -13,13 +13,19 @@
|
||||
"iou": {
|
||||
"ethernet_adapters": 4,
|
||||
"serial_adapters": 0,
|
||||
"nvram": 128,
|
||||
"ram": 256,
|
||||
"nvram": 512,
|
||||
"ram": 512,
|
||||
"startup_config": "iou_l2_base_startup-config.txt"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "x86_64_crb_linux_l2-adventerprisek9-ms.bin",
|
||||
"filename": "x86_64_crb_linux_l2-adventerprisek9-ms.iol",
|
||||
"version": "17.15.1",
|
||||
"md5sum": "6c587cdfd5056078e70b3f6c26800d66",
|
||||
"filesize": 243251976
|
||||
},
|
||||
{
|
||||
"filename": "x86_64_crb_linux_l2-adventerprisek9-ms",
|
||||
"version": "17.12.1",
|
||||
"md5sum": "2b5055e4cef8fd257416d74a94adb626",
|
||||
"filesize": 240355720
|
||||
@@ -44,10 +50,16 @@
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "17.15.1",
|
||||
"images": {
|
||||
"image": "x86_64_crb_linux_l2-adventerprisek9-ms.iol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "17.12.1",
|
||||
"images": {
|
||||
"image": "x86_64_crb_linux_l2-adventerprisek9-ms.bin"
|
||||
"image": "x86_64_crb_linux_l2-adventerprisek9-ms"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -13,13 +13,19 @@
|
||||
"iou": {
|
||||
"ethernet_adapters": 2,
|
||||
"serial_adapters": 2,
|
||||
"nvram": 128,
|
||||
"ram": 256,
|
||||
"nvram": 512,
|
||||
"ram": 512,
|
||||
"startup_config": "iou_l3_base_startup-config.txt"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "x86_64_crb_linux-adventerprisek9-ms.bin",
|
||||
"filename": "x86_64_crb_linux-adventerprisek9-ms.iol",
|
||||
"version": "17.15.1",
|
||||
"md5sum": "5d584f6cfbeaadc87d55f613da1049ed",
|
||||
"filesize": 292001512
|
||||
},
|
||||
{
|
||||
"filename": "x86_64_crb_linux-adventerprisek9-ms",
|
||||
"version": "17.12.1",
|
||||
"md5sum": "4a2fce8de21d1831fbceffd155e41ae7",
|
||||
"filesize": 288947184
|
||||
@@ -44,10 +50,16 @@
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "17.15.1",
|
||||
"images": {
|
||||
"image": "x86_64_crb_linux-adventerprisek9-ms.iol"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "17.12.1",
|
||||
"images": {
|
||||
"image": "x86_64_crb_linux-adventerprisek9-ms.bin"
|
||||
"image": "x86_64_crb_linux-adventerprisek9-ms"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"appliance_id": "92dbd0e9-144e-4c59-a4a8-97b6a1661818",
|
||||
"name": "Innovaphone App-Platform",
|
||||
"category": "guest",
|
||||
"description": "In addition to telephony, apps for Video Telephony, Chat, Conferencing, Application Sharing and many other functions have become indispensable UCC tools in the area of business communication. Based on the myApps platform and its various components, innovaphone provides a collaborative work and communication platform for enhanced corporate communications \u2013 regardless of the location and the device being used. The innovaphone platform myApps consists of many independent components that work well individually, yet unfold their remarkable performance when combined.",
|
||||
"vendor_name": "Innovaphone",
|
||||
"vendor_url": "https://www.innovaphone.com",
|
||||
"vendor_logo_url": "https://www.innovaphone.com/content/downloads/innovaphone-myapps-logo-short-without-background-screen.png",
|
||||
"documentation_url": "https://wiki.innovaphone.com/index.php?title=Reference14r2:Concept_App_Platform",
|
||||
"product_name": "App-Platform",
|
||||
"product_url": "https://www.innovaphone.com/en/products/myapps/myapps-platform.html",
|
||||
"registry_version": 4,
|
||||
"status": "experimental",
|
||||
"availability": "free-to-try",
|
||||
"maintainer": "Thomas Marchsteiner",
|
||||
"maintainer_email": "thomas.marchsteiner@acp.at",
|
||||
"usage": "Default users console:root/iplinux , ssh:admin/ipapps , Webinterface:pwd \nAfter first boot wait for automatic reboot.\nA static ip can be set via the setip utility. \nLoading another keymap can be done via the loadkeys command. \nThe app-platform-disk1.vmdk file is contained within an ova file. \nIt can be extraced with the tar utility, 7Zip or any other tool which can handle tar files.",
|
||||
"symbol": "innovaphone-ap-icon.jpg",
|
||||
"first_port_name": "eth0",
|
||||
"qemu": {
|
||||
"adapter_type": "vmxnet3",
|
||||
"adapters": 1,
|
||||
"ram": 512,
|
||||
"cpus": 1,
|
||||
"hda_disk_interface": "scsi",
|
||||
"arch": "x86_64",
|
||||
"console_type": "vnc",
|
||||
"boot_priority": "d",
|
||||
"kvm": "allow",
|
||||
"on_close": "power_off",
|
||||
"process_priority": "normal"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "app-platform-disk1_120010.vmdk",
|
||||
"version": "12.0010",
|
||||
"md5sum": "d5a5a77f682c2c988b0810935d79a787",
|
||||
"filesize": 129474560,
|
||||
"download_url": "https://store.innovaphone.com/"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"images": {
|
||||
"hda_disk_image": "app-platform-disk1_120010.vmdk"
|
||||
},
|
||||
"name": "12.0010"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"appliance_id": "ddf8f7a4-60c0-4c9d-849c-ffc3c9d1d082",
|
||||
"name": "Innovaphone IPVA",
|
||||
"category": "guest",
|
||||
"description": "The innovaphone PBX is a professional IP telephone system. The IPVA is a software-only solution. It appears as and performs as an innovaphone 'hard-box' excluding DSP-, ISDN-/AB-resources.",
|
||||
"vendor_name": "Innovaphone",
|
||||
"vendor_url": "https://www.innovaphone.com/",
|
||||
"vendor_logo_url": "https://www.innovaphone.com/content/downloads/innovaphone-myapps-logo-short-without-background-screen.png",
|
||||
"documentation_url": "https://wiki.innovaphone.com/index.php?title=Reference15r1:Concept_Innovaphone_Virtual_Appliance_(IPVA)",
|
||||
"product_name": "IPVA",
|
||||
"product_url": "https://www.innovaphone.com/en/products/innovaphone-pbx.html",
|
||||
"registry_version": 4,
|
||||
"status": "experimental",
|
||||
"availability": "free-to-try",
|
||||
"maintainer": "Thomas Marchsteiner",
|
||||
"maintainer_email": "thomas.marchsteiner@acp.at",
|
||||
"usage": "Default user admin/ipva \nDefault network configuration: DHCP client on eth0 with fallback to static address 192.168.0.1/24 after timeout. Static address 192.168.1.1/24 on eth1\n The ova in the zip file contains the disk images to run this appliance. Disableing the dhcp client and setting a static IP is possible with the following commands:\n> config change IP0 ETH0 /addr 192.168.0.1 /mask 255.255.255.0 \n> config change DHCP0 /mode off \n> config write \n> config activate \n> reset",
|
||||
"symbol": "innovaphone-pbx-green.png",
|
||||
"first_port_name": "eth0",
|
||||
"port_name_format": "eth{port1}",
|
||||
"qemu": {
|
||||
"adapter_type": "vmxnet3",
|
||||
"adapters": 2,
|
||||
"ram": 256,
|
||||
"cpus": 1,
|
||||
"hda_disk_interface": "ide",
|
||||
"hdb_disk_interface": "ide",
|
||||
"hdc_disk_interface": "ide",
|
||||
"hdd_disk_interface": "ide",
|
||||
"arch": "x86_64",
|
||||
"console_type": "vnc",
|
||||
"boot_priority": "d",
|
||||
"kvm": "allow",
|
||||
"on_close": "power_off",
|
||||
"process_priority": "normal"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "ipva-qemu-disk1-14r2.vmdk",
|
||||
"version": "14r2",
|
||||
"md5sum": "aaa1c3885eee30ca6ffa3827619e8643",
|
||||
"filesize": 6269952,
|
||||
"download_url": "https://store.innovaphone.com/"
|
||||
},
|
||||
{
|
||||
"filename": "ipva-qemu-disk2-14r2.vmdk",
|
||||
"version": "14r2",
|
||||
"md5sum": "008a8fc6b0b1e5f11a3e7fd6f22ba349",
|
||||
"filesize": 72192,
|
||||
"download_url": "https://store.innovaphone.com/"
|
||||
},
|
||||
{
|
||||
"filename": "ipva-qemu-disk3-14r2.vmdk",
|
||||
"version": "14r2",
|
||||
"md5sum": "20516731c480e2112b3fb4a4d7f514f2",
|
||||
"filesize": 68096,
|
||||
"download_url": "https://store.innovaphone.com/"
|
||||
},
|
||||
{
|
||||
"filename": "ipva-qemu-disk4-14r2.vmdk",
|
||||
"version": "14r2",
|
||||
"md5sum": "15d7d79ef8c28bd29b2eceac8405f964",
|
||||
"filesize": 68096,
|
||||
"download_url": "https://store.innovaphone.com/"
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"images": {
|
||||
"hda_disk_image": "ipva-qemu-disk1-14r2.vmdk",
|
||||
"hdb_disk_image": "ipva-qemu-disk2-14r2.vmdk",
|
||||
"hdc_disk_image": "ipva-qemu-disk3-14r2.vmdk",
|
||||
"hdd_disk_image": "ipva-qemu-disk4-14r2.vmdk"
|
||||
},
|
||||
"name": "14r2"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -24,6 +24,13 @@
|
||||
"process_priority": "normal"
|
||||
},
|
||||
"images": [
|
||||
{
|
||||
"filename": "pfSense-CE-2.7.2-RELEASE-amd64.iso",
|
||||
"version": "2.7.2",
|
||||
"md5sum": "50c3e723d68ec74d038041a34fa846f8",
|
||||
"filesize": 874672128,
|
||||
"download_url": "https://www.pfsense.org/download/mirror.php?section=downloads"
|
||||
},
|
||||
{
|
||||
"filename": "pfSense-CE-2.7.0-RELEASE-amd64.iso",
|
||||
"version": "2.7.0",
|
||||
@@ -76,6 +83,13 @@
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"name": "2.7.2",
|
||||
"images": {
|
||||
"hda_disk_image": "empty100G.qcow2",
|
||||
"cdrom_image": "pfSense-CE-2.7.2-RELEASE-amd64.iso"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "2.7.0",
|
||||
"images": {
|
||||
|
||||
@@ -115,7 +115,7 @@ class Docker(BaseManager):
|
||||
dst_path = self.resources_path()
|
||||
log.info(f"Installing Docker resources in '{dst_path}'")
|
||||
from gns3server.controller import Controller
|
||||
Controller.instance().install_resource_files(dst_path, "compute/docker/resources")
|
||||
await Controller.instance().install_resource_files(dst_path, "compute/docker/resources")
|
||||
await self.install_busybox(dst_path)
|
||||
except OSError as e:
|
||||
raise DockerError(f"Could not install Docker resources to {dst_path}: {e}")
|
||||
|
||||
@@ -436,14 +436,16 @@ class IOUVM(BaseNode):
|
||||
)
|
||||
)
|
||||
|
||||
async def _check_iou_licence(self):
|
||||
def _is_iou_license_check_enabled(self):
|
||||
"""
|
||||
Checks for a valid IOU key in the iourc file (paranoid mode).
|
||||
Returns if IOU license check is enabled.
|
||||
|
||||
:return: boolean
|
||||
"""
|
||||
|
||||
# license check is sent by the controller
|
||||
if self.license_check is False:
|
||||
return
|
||||
return False
|
||||
|
||||
try:
|
||||
# we allow license check to be disabled server wide
|
||||
@@ -453,7 +455,14 @@ class IOUVM(BaseNode):
|
||||
|
||||
if server_wide_license_check is False:
|
||||
log.warning("License check is explicitly disabled on this server")
|
||||
return
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
async def _check_iou_license(self):
|
||||
"""
|
||||
Checks for a valid IOU key in the iourc file (paranoid mode).
|
||||
"""
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
try:
|
||||
@@ -559,15 +568,16 @@ class IOUVM(BaseNode):
|
||||
except OSError as e:
|
||||
raise IOUError(f"Could not rename nvram files: {e}")
|
||||
|
||||
iourc_path = self.iourc_path
|
||||
if not iourc_path:
|
||||
raise IOUError("Could not find an iourc file (IOU license), please configure an IOU license")
|
||||
if not os.path.isfile(iourc_path):
|
||||
raise IOUError(f"The iourc path '{iourc_path}' is not a regular file")
|
||||
iourc_path = None
|
||||
if self._is_iou_license_check_enabled():
|
||||
iourc_path = self.iourc_path
|
||||
if not iourc_path:
|
||||
raise IOUError("Could not find an iourc file (IOU license), please configure an IOU license")
|
||||
if not os.path.isfile(iourc_path):
|
||||
raise IOUError(f"The iourc path '{iourc_path}' is not a regular file")
|
||||
await self._check_iou_license()
|
||||
|
||||
await self._check_iou_licence()
|
||||
await self._start_ubridge()
|
||||
|
||||
self._create_netmap_config()
|
||||
if self.use_default_iou_values:
|
||||
# make sure we have the default nvram amount to correctly push the configs
|
||||
@@ -579,7 +589,7 @@ class IOUVM(BaseNode):
|
||||
|
||||
self._nvram_watcher = FileWatcher(self._nvram_file(), self._nvram_changed, delay=2)
|
||||
|
||||
# created a environment variable pointing to the iourc file.
|
||||
# created an environment variable pointing to the iourc file.
|
||||
env = os.environ.copy()
|
||||
if "IOURC" not in os.environ and iourc_path:
|
||||
env["IOURC"] = iourc_path
|
||||
|
||||
@@ -28,10 +28,10 @@ try:
|
||||
except ImportError:
|
||||
from importlib import resources as importlib_resources
|
||||
|
||||
|
||||
from ..config import Config
|
||||
from ..utils import parse_version, md5sum
|
||||
from ..utils.images import default_images_directory
|
||||
from ..utils.asyncio import wait_run_in_executor
|
||||
|
||||
from .project import Project
|
||||
from .appliance import Appliance
|
||||
@@ -43,6 +43,7 @@ from .topology import load_topology
|
||||
from .gns3vm import GNS3VM
|
||||
from .gns3vm.gns3_vm_error import GNS3VMError
|
||||
from .controller_error import ControllerError, ControllerNotFoundError
|
||||
from ..db.tasks import update_disk_checksums
|
||||
from ..version import __version__
|
||||
|
||||
import logging
|
||||
@@ -64,7 +65,7 @@ class Controller:
|
||||
self.gns3vm = GNS3VM(self)
|
||||
self.symbols = Symbols()
|
||||
self._appliance_manager = ApplianceManager()
|
||||
self._iou_license_settings = {"iourc_content": "", "license_check": True}
|
||||
self._iou_license_settings = {"iourc_content": "", "license_check": False}
|
||||
self._vars_loaded = False
|
||||
self._vars_file = Config.instance().controller_vars
|
||||
log.info(f'Loading controller vars file "{self._vars_file}"')
|
||||
@@ -72,8 +73,11 @@ class Controller:
|
||||
async def start(self, computes=None):
|
||||
|
||||
log.info("Controller is starting")
|
||||
self._install_base_configs()
|
||||
self._install_builtin_disks()
|
||||
await self._install_base_configs()
|
||||
installed_disks = await self._install_builtin_disks()
|
||||
if installed_disks:
|
||||
await update_disk_checksums(installed_disks)
|
||||
|
||||
server_config = Config.instance().settings.Server
|
||||
Config.instance().listen_for_config_changes(self._update_config)
|
||||
name = server_config.name
|
||||
@@ -86,7 +90,7 @@ class Controller:
|
||||
if host == "0.0.0.0":
|
||||
host = "127.0.0.1"
|
||||
|
||||
self._load_controller_vars()
|
||||
await self._load_controller_vars()
|
||||
|
||||
if server_config.enable_ssl:
|
||||
self._ssl_context = self._create_ssl_context(server_config)
|
||||
@@ -134,7 +138,9 @@ class Controller:
|
||||
log.warning(str(e))
|
||||
|
||||
await self.load_projects()
|
||||
await self._project_auto_open()
|
||||
|
||||
# start to auto open projects (if configured) 5 seconds after the controller has started
|
||||
asyncio.get_event_loop().call_later(5, asyncio.create_task, self._project_auto_open())
|
||||
|
||||
def _create_ssl_context(self, server_config):
|
||||
|
||||
@@ -188,7 +194,7 @@ class Controller:
|
||||
async def reload(self):
|
||||
|
||||
log.info("Controller is reloading")
|
||||
self._load_controller_vars()
|
||||
await self._load_controller_vars()
|
||||
|
||||
# remove all projects deleted from disk.
|
||||
for project in self._projects.copy().values():
|
||||
@@ -208,19 +214,15 @@ class Controller:
|
||||
if self._vars_loaded:
|
||||
controller_vars = {
|
||||
"appliances_etag": self._appliance_manager.appliances_etag,
|
||||
"iou_license_check": self._iou_license_settings["license_check"],
|
||||
"version": __version__
|
||||
}
|
||||
|
||||
if self._iou_license_settings["iourc_content"]:
|
||||
|
||||
iou_config = Config.instance().settings.IOU
|
||||
server_config = Config.instance().settings.Server
|
||||
|
||||
if iou_config.iourc_path:
|
||||
iourc_path = iou_config.iourc_path
|
||||
else:
|
||||
os.makedirs(server_config.secrets_dir, exist_ok=True)
|
||||
iourc_path = os.path.join(server_config.secrets_dir, "gns3_iourc_license")
|
||||
os.makedirs(server_config.secrets_dir, exist_ok=True)
|
||||
iourc_path = os.path.join(server_config.secrets_dir, "iou_license")
|
||||
|
||||
try:
|
||||
with open(iourc_path, "w+") as f:
|
||||
@@ -236,7 +238,7 @@ class Controller:
|
||||
except OSError as e:
|
||||
log.error(f"Cannot write controller vars file '{self._vars_file}': {e}")
|
||||
|
||||
def _load_controller_vars(self):
|
||||
async def _load_controller_vars(self):
|
||||
"""
|
||||
Reload the controller vars from disk
|
||||
"""
|
||||
@@ -251,15 +253,11 @@ class Controller:
|
||||
return []
|
||||
|
||||
# load the IOU license settings
|
||||
iou_config = Config.instance().settings.IOU
|
||||
server_config = Config.instance().settings.Server
|
||||
|
||||
if iou_config.iourc_path:
|
||||
iourc_path = iou_config.iourc_path
|
||||
else:
|
||||
if not server_config.secrets_dir:
|
||||
server_config.secrets_dir = os.path.dirname(Config.instance().server_config)
|
||||
iourc_path = os.path.join(server_config.secrets_dir, "gns3_iourc_license")
|
||||
if not server_config.secrets_dir:
|
||||
server_config.secrets_dir = os.path.dirname(Config.instance().server_config)
|
||||
iourc_path = os.path.join(server_config.secrets_dir, "iou_license")
|
||||
|
||||
if os.path.exists(iourc_path):
|
||||
try:
|
||||
@@ -268,7 +266,10 @@ class Controller:
|
||||
log.info(f"iourc file '{iourc_path}' loaded")
|
||||
except OSError as e:
|
||||
log.error(f"Cannot read IOU license file '{iourc_path}': {e}")
|
||||
self._iou_license_settings["license_check"] = iou_config.license_check
|
||||
|
||||
# IOU license check is disabled by default
|
||||
self._iou_license_settings["license_check"] = controller_vars.get("iou_license_check", False)
|
||||
log.info("IOU license check is {} on the controller".format("enabled" if self._iou_license_settings["license_check"] else "disabled"))
|
||||
|
||||
# install the built-in appliances if needed
|
||||
if Config.instance().settings.Server.install_builtin_appliances:
|
||||
@@ -277,9 +278,9 @@ class Controller:
|
||||
builtin_appliances_path = self._appliance_manager.builtin_appliances_path()
|
||||
if not previous_version or \
|
||||
parse_version(__version__.split("+")[0]) > parse_version(previous_version.split("+")[0]):
|
||||
self._appliance_manager.install_builtin_appliances()
|
||||
await self._appliance_manager.install_builtin_appliances()
|
||||
elif not os.listdir(builtin_appliances_path):
|
||||
self._appliance_manager.install_builtin_appliances()
|
||||
await self._appliance_manager.install_builtin_appliances()
|
||||
else:
|
||||
log.info(f"Built-in appliances are installed in '{builtin_appliances_path}'")
|
||||
|
||||
@@ -310,18 +311,21 @@ class Controller:
|
||||
|
||||
|
||||
@staticmethod
|
||||
def install_resource_files(dst_path, resource_name, upgrade_resources=True):
|
||||
async def install_resource_files(dst_path, resource_name, upgrade_resources=True):
|
||||
"""
|
||||
Install files from resources to user's file system
|
||||
"""
|
||||
|
||||
def should_copy(src, dst, upgrade_resources):
|
||||
installed_resources = []
|
||||
async def should_copy(src, dst, upgrade_resources):
|
||||
if not os.path.exists(dst):
|
||||
return True
|
||||
if upgrade_resources is False:
|
||||
return False
|
||||
# copy the resource if it is different
|
||||
return md5sum(src) != md5sum(dst)
|
||||
src_md5 = await wait_run_in_executor(md5sum, src)
|
||||
dst_md5 = await wait_run_in_executor(md5sum, dst)
|
||||
return src_md5 != dst_md5
|
||||
|
||||
if hasattr(sys, "frozen") and sys.platform.startswith("win"):
|
||||
resource_path = os.path.normpath(os.path.join(os.path.dirname(sys.executable), resource_name))
|
||||
@@ -331,14 +335,16 @@ class Controller:
|
||||
else:
|
||||
for entry in importlib_resources.files('gns3server').joinpath(resource_name).iterdir():
|
||||
full_path = os.path.join(dst_path, entry.name)
|
||||
if entry.is_file() and should_copy(str(entry), full_path, upgrade_resources):
|
||||
if entry.is_file() and await should_copy(str(entry), full_path, upgrade_resources):
|
||||
log.debug(f'Installing {resource_name} resource file "{entry.name}" to "{full_path}"')
|
||||
shutil.copy(str(entry), os.path.join(dst_path, entry.name))
|
||||
shutil.copy(str(entry), os.path.join(full_path))
|
||||
installed_resources.append(full_path)
|
||||
elif entry.is_dir():
|
||||
os.makedirs(full_path, exist_ok=True)
|
||||
Controller.install_resource_files(full_path, os.path.join(resource_name, entry.name))
|
||||
await Controller.install_resource_files(full_path, os.path.join(resource_name, entry.name))
|
||||
return installed_resources
|
||||
|
||||
def _install_base_configs(self):
|
||||
async def _install_base_configs(self):
|
||||
"""
|
||||
At startup we copy base configs to the user location to allow
|
||||
them to customize it
|
||||
@@ -347,11 +353,12 @@ class Controller:
|
||||
dst_path = self.configs_path()
|
||||
log.info(f"Installing base configs in '{dst_path}'")
|
||||
try:
|
||||
Controller.install_resource_files(dst_path, "configs", upgrade_resources=False)
|
||||
# do not overwrite base configs because they may have been customized by the user
|
||||
await Controller.install_resource_files(dst_path, "configs", upgrade_resources=False)
|
||||
except OSError as e:
|
||||
log.error(f"Could not install base config files to {dst_path}: {e}")
|
||||
|
||||
def _install_builtin_disks(self):
|
||||
async def _install_builtin_disks(self):
|
||||
"""
|
||||
At startup we copy built-in Qemu disks to the user location to allow
|
||||
them to use with appliances
|
||||
@@ -360,7 +367,7 @@ class Controller:
|
||||
dst_path = self.disks_path()
|
||||
log.info(f"Installing built-in disks in '{dst_path}'")
|
||||
try:
|
||||
Controller.install_resource_files(dst_path, "disks", upgrade_resources=False)
|
||||
return await Controller.install_resource_files(dst_path, "disks")
|
||||
except OSError as e:
|
||||
log.error(f"Could not install disk files to {dst_path}: {e}")
|
||||
|
||||
@@ -600,9 +607,12 @@ class Controller:
|
||||
Auto open the project with auto open enable
|
||||
"""
|
||||
|
||||
for project in self._projects.values():
|
||||
if project.auto_open:
|
||||
await project.open()
|
||||
try:
|
||||
for project in self._projects.values():
|
||||
if project.auto_open:
|
||||
await project.open()
|
||||
except ControllerError as e:
|
||||
log.error(f"Could not auto open projects: {e}")
|
||||
|
||||
def get_free_project_name(self, base_name):
|
||||
"""
|
||||
|
||||
@@ -110,7 +110,7 @@ class ApplianceManager:
|
||||
os.makedirs(appliances_dir, exist_ok=True)
|
||||
return appliances_dir
|
||||
|
||||
def install_builtin_appliances(self):
|
||||
async def install_builtin_appliances(self):
|
||||
"""
|
||||
At startup we copy the built-in appliances files.
|
||||
"""
|
||||
@@ -119,7 +119,7 @@ class ApplianceManager:
|
||||
log.info(f"Installing built-in appliances in '{dst_path}'")
|
||||
from . import Controller
|
||||
try:
|
||||
Controller.instance().install_resource_files(dst_path, "appliances")
|
||||
await Controller.instance().install_resource_files(dst_path, "appliances")
|
||||
except OSError as e:
|
||||
log.error(f"Could not install built-in appliance files to {dst_path}: {e}")
|
||||
|
||||
|
||||
@@ -18,14 +18,19 @@
|
||||
import ipaddress
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import async_timeout
|
||||
import socket
|
||||
import json
|
||||
import sys
|
||||
import io
|
||||
|
||||
from fastapi import HTTPException
|
||||
from aiohttp import web
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from asyncio import timeout as asynctimeout
|
||||
else:
|
||||
from async_timeout import timeout as asynctimeout
|
||||
|
||||
from ..utils import parse_version
|
||||
from ..utils.asyncio import locking
|
||||
from ..controller.controller_error import (
|
||||
@@ -502,8 +507,8 @@ class Compute:
|
||||
""" Returns URL for specific path at Compute"""
|
||||
return self._getUrl(path)
|
||||
|
||||
async def _run_http_query(self, method, path, data=None, timeout=20, raw=False):
|
||||
async with async_timeout.timeout(delay=timeout):
|
||||
async def _run_http_query(self, method, path, data=None, timeout=120, raw=False):
|
||||
async with asynctimeout(delay=timeout):
|
||||
url = self._getUrl(path)
|
||||
headers = {"content-type": "application/json"}
|
||||
chunked = None
|
||||
|
||||
@@ -572,15 +572,11 @@ class Node:
|
||||
Start a node
|
||||
"""
|
||||
try:
|
||||
# For IOU we need to send the licence everytime
|
||||
# For IOU: we need to send the licence everytime we start a node
|
||||
if self.node_type == "iou":
|
||||
license_check = self._project.controller.iou_license.get("license_check", True)
|
||||
iourc_content = self._project.controller.iou_license.get("iourc_content", None)
|
||||
# if license_check and not iourc_content:
|
||||
# raise aiohttp.web.HTTPConflict(text="IOU licence is not configured")
|
||||
await self.post(
|
||||
"/start", timeout=240, data={"license_check": license_check, "iourc_content": iourc_content}
|
||||
)
|
||||
await self.post("/start", timeout=240, data={"license_check": license_check, "iourc_content": iourc_content})
|
||||
else:
|
||||
await self.post("/start", data=data, timeout=240)
|
||||
except asyncio.TimeoutError:
|
||||
|
||||
@@ -595,7 +595,7 @@ class Project:
|
||||
|
||||
if node_type == "iou":
|
||||
async with self._iou_id_lock:
|
||||
# wait for a IOU node to be completely created before adding a new one
|
||||
# wait for an IOU node to be completely created before adding a new one
|
||||
# this is important otherwise we allocate the same application ID (used
|
||||
# to generate MAC addresses) when creating multiple IOU node at the same time
|
||||
if "properties" in kwargs.keys():
|
||||
@@ -1339,7 +1339,6 @@ class Project:
|
||||
Copy the project files directly rather than in an import-export fashion.
|
||||
|
||||
:param name: Name of the new project. A new one will be generated in case of conflicts
|
||||
:param location: Parent directory of the new project
|
||||
:param reset_mac_addresses: Reset MAC addresses for the new project
|
||||
"""
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class CrashReport:
|
||||
Report crash to a third party service
|
||||
"""
|
||||
|
||||
DSN = "https://29d15f2b7fde7fbd860843b7ee24dc7f@o19455.ingest.us.sentry.io/38482"
|
||||
DSN = "https://9cf53e6b9adfe49b867f1847b7cc4d72@o19455.ingest.us.sentry.io/38482"
|
||||
_instance = None
|
||||
|
||||
def __init__(self):
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
import os
|
||||
|
||||
from typing import Optional, List
|
||||
from sqlalchemy import select, delete
|
||||
from sqlalchemy import select, delete, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from .base import BaseRepository
|
||||
@@ -103,6 +103,22 @@ class ImagesRepository(BaseRepository):
|
||||
await self._db_session.refresh(db_image)
|
||||
return db_image
|
||||
|
||||
async def update_image(self, image_path: str, checksum: str, checksum_algorithm: str) -> models.Image:
|
||||
"""
|
||||
Update an image.
|
||||
"""
|
||||
|
||||
query = update(models.Image).\
|
||||
where(models.Image.path == image_path).\
|
||||
values(checksum=checksum, checksum_algorithm=checksum_algorithm)
|
||||
|
||||
await self._db_session.execute(query)
|
||||
await self._db_session.commit()
|
||||
image_db = await self.get_image_by_checksum(checksum)
|
||||
if image_db:
|
||||
await self._db_session.refresh(image_db) # force refresh of updated_at value
|
||||
return image_db
|
||||
|
||||
async def delete_image(self, image_path: str) -> bool:
|
||||
"""
|
||||
Delete an image.
|
||||
@@ -119,7 +135,7 @@ class ImagesRepository(BaseRepository):
|
||||
await self._db_session.commit()
|
||||
return result.rowcount > 0
|
||||
|
||||
async def prune_images(self) -> int:
|
||||
async def prune_images(self, skip_images: list[str] = None) -> int:
|
||||
"""
|
||||
Prune images not attached to any template.
|
||||
"""
|
||||
@@ -130,12 +146,15 @@ class ImagesRepository(BaseRepository):
|
||||
images = result.scalars().all()
|
||||
images_deleted = 0
|
||||
for image in images:
|
||||
if skip_images and image.filename in skip_images:
|
||||
log.debug(f"Skipping image '{image.path}' for pruning")
|
||||
continue
|
||||
try:
|
||||
log.debug(f"Deleting image '{image.path}'")
|
||||
os.remove(image.path)
|
||||
except OSError:
|
||||
log.warning(f"Could not delete image file {image.path}")
|
||||
if await self.delete_image(image.filename):
|
||||
if await self.delete_image(image.path):
|
||||
images_deleted += 1
|
||||
log.info(f"{images_deleted} image(s) have been deleted")
|
||||
return images_deleted
|
||||
@@ -80,7 +80,7 @@ class ResourcePoolsRepository(BaseRepository):
|
||||
await self._db_session.commit()
|
||||
return result.rowcount > 0
|
||||
|
||||
async def get_resource_memberships(self, resource_id: UUID) -> List[models.UserGroup]:
|
||||
async def get_resource_memberships(self, resource_id: UUID) -> List[models.ResourcePool]:
|
||||
"""
|
||||
Get all resource memberships in resource pools.
|
||||
"""
|
||||
|
||||
@@ -170,3 +170,14 @@ class TemplatesRepository(BaseRepository):
|
||||
await self._db_session.commit()
|
||||
await self._db_session.refresh(template_in_db)
|
||||
return template_in_db
|
||||
|
||||
async def get_template_images(self, template_id: UUID) -> List[models.Image]:
|
||||
"""
|
||||
Return all images attached to a template.
|
||||
"""
|
||||
|
||||
query = select(models.Image).\
|
||||
join(models.Image.templates).\
|
||||
filter(models.Template.template_id == template_id)
|
||||
result = await self._db_session.execute(query)
|
||||
return result.scalars().all()
|
||||
+120
-79
@@ -16,13 +16,11 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import signal
|
||||
import time
|
||||
import os
|
||||
|
||||
from fastapi import FastAPI
|
||||
from pydantic import ValidationError
|
||||
from watchfiles import awatch, Change
|
||||
|
||||
from typing import List
|
||||
from sqlalchemy import event
|
||||
from sqlalchemy.engine import Engine
|
||||
@@ -32,10 +30,13 @@ from alembic import command, config
|
||||
from alembic.script import ScriptDirectory
|
||||
from alembic.runtime.migration import MigrationContext
|
||||
from alembic.util.exc import CommandError
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEvent, PatternMatchingEventHandler
|
||||
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.utils.images import discover_images, check_valid_image_header, read_image_info, default_images_directory, InvalidImageError
|
||||
from gns3server.utils.images import md5sum, discover_images, read_image_info, InvalidImageError
|
||||
from gns3server.utils.asyncio import wait_run_in_executor
|
||||
from gns3server import schemas
|
||||
|
||||
from .models import Base
|
||||
@@ -130,81 +131,7 @@ async def get_computes(app: FastAPI) -> List[dict]:
|
||||
return computes
|
||||
|
||||
|
||||
def image_filter(change: Change, path: str) -> bool:
|
||||
|
||||
if change == Change.added and os.path.isfile(path):
|
||||
if path.endswith(".tmp") or path.endswith(".md5sum") or path.startswith("."):
|
||||
return False
|
||||
if "/lib/" in path or "/lib64/" in path:
|
||||
# ignore custom IOU libraries
|
||||
return False
|
||||
header_magic_len = 7
|
||||
with open(path, "rb") as f:
|
||||
image_header = f.read(header_magic_len) # read the first 7 bytes of the file
|
||||
if len(image_header) >= header_magic_len:
|
||||
try:
|
||||
check_valid_image_header(image_header)
|
||||
except InvalidImageError as e:
|
||||
log.debug(f"New image '{path}': {e}")
|
||||
return False
|
||||
else:
|
||||
log.debug(f"New image '{path}': size is too small to be valid")
|
||||
return False
|
||||
return True
|
||||
# FIXME: should we support image deletion?
|
||||
# elif change == Change.deleted:
|
||||
# return True
|
||||
return False
|
||||
|
||||
|
||||
async def monitor_images_on_filesystem(app: FastAPI):
|
||||
|
||||
directories_to_monitor = []
|
||||
for image_type in ("qemu", "ios", "iou"):
|
||||
image_dir = default_images_directory(image_type)
|
||||
if os.path.isdir(image_dir):
|
||||
log.debug(f"Monitoring for new images in '{image_dir}'")
|
||||
directories_to_monitor.append(image_dir)
|
||||
|
||||
try:
|
||||
async for changes in awatch(
|
||||
*directories_to_monitor,
|
||||
watch_filter=image_filter,
|
||||
raise_interrupt=True
|
||||
):
|
||||
async with AsyncSession(app.state._db_engine) as db_session:
|
||||
images_repository = ImagesRepository(db_session)
|
||||
for change in changes:
|
||||
change_type, image_path = change
|
||||
if change_type == Change.added:
|
||||
try:
|
||||
image = await read_image_info(image_path)
|
||||
except InvalidImageError as e:
|
||||
log.warning(str(e))
|
||||
continue
|
||||
try:
|
||||
if await images_repository.get_image(image_path):
|
||||
continue
|
||||
await images_repository.add_image(**image)
|
||||
log.info(f"Discovered image '{image_path}' has been added to the database")
|
||||
except SQLAlchemyError as e:
|
||||
log.warning(f"Error while adding image '{image_path}' to the database: {e}")
|
||||
# if change_type == Change.deleted:
|
||||
# try:
|
||||
# if await images_repository.get_image(image_path):
|
||||
# success = await images_repository.delete_image(image_path)
|
||||
# if not success:
|
||||
# log.warning(f"Could not delete image '{image_path}' from the database")
|
||||
# else:
|
||||
# log.info(f"Image '{image_path}' has been deleted from the database")
|
||||
# except SQLAlchemyError as e:
|
||||
# log.warning(f"Error while deleting image '{image_path}' from the database: {e}")
|
||||
except KeyboardInterrupt:
|
||||
# send SIGTERM to the server PID so uvicorn can shutdown the process
|
||||
os.kill(os.getpid(), signal.SIGTERM)
|
||||
|
||||
|
||||
async def discover_images_on_filesystem(app: FastAPI):
|
||||
async def discover_images_on_filesystem(app: FastAPI) -> None:
|
||||
|
||||
async with AsyncSession(app.state._db_engine) as db_session:
|
||||
images_repository = ImagesRepository(db_session)
|
||||
@@ -228,3 +155,117 @@ async def discover_images_on_filesystem(app: FastAPI):
|
||||
|
||||
# monitor if images have been manually added
|
||||
asyncio.create_task(monitor_images_on_filesystem(app))
|
||||
|
||||
|
||||
async def update_disk_checksums(updated_disks: List[str]) -> None:
|
||||
"""
|
||||
Update the checksum of a list of disks in the database.
|
||||
|
||||
:param updated_disks: list of updated disks
|
||||
"""
|
||||
|
||||
from gns3server.api.server import app
|
||||
async with AsyncSession(app.state._db_engine) as db_session:
|
||||
images_repository = ImagesRepository(db_session)
|
||||
for path in updated_disks:
|
||||
image = await images_repository.get_image(path)
|
||||
if image:
|
||||
log.info(f"Updating image '{path}' in the database")
|
||||
checksum = await wait_run_in_executor(md5sum, path, cache_to_md5file=False)
|
||||
if image.checksum != checksum:
|
||||
await images_repository.update_image(path, checksum, "md5")
|
||||
|
||||
class EventHandler(PatternMatchingEventHandler):
|
||||
"""
|
||||
Watchdog event handler.
|
||||
"""
|
||||
|
||||
def __init__(self, queue: asyncio.Queue, loop: asyncio.BaseEventLoop, **kwargs):
|
||||
|
||||
self._loop = loop
|
||||
self._queue = queue
|
||||
|
||||
# ignore temporary files, md5sum files, hidden files and directories
|
||||
super().__init__(ignore_patterns=["*.tmp", "*.md5sum", ".*"], ignore_directories = True, **kwargs)
|
||||
|
||||
def on_closed(self, event: FileSystemEvent) -> None:
|
||||
# monitor for closed files (e.g. when a file has finished to be copied)
|
||||
if "/lib/" in event.src_path or "/lib64/" in event.src_path:
|
||||
return # ignore custom IOU libraries
|
||||
self._loop.call_soon_threadsafe(self._queue.put_nowait, event)
|
||||
|
||||
class EventIterator(object):
|
||||
"""
|
||||
Watchdog Event iterator.
|
||||
"""
|
||||
|
||||
def __init__(self, queue: asyncio.Queue):
|
||||
self.queue = queue
|
||||
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
|
||||
item = await self.queue.get()
|
||||
if item is None:
|
||||
raise StopAsyncIteration
|
||||
return item
|
||||
|
||||
async def monitor_images_on_filesystem(app: FastAPI):
|
||||
|
||||
def watchdog(
|
||||
path: str,
|
||||
queue: asyncio.Queue,
|
||||
loop: asyncio.BaseEventLoop,
|
||||
app: FastAPI, recursive: bool = False
|
||||
) -> None:
|
||||
"""
|
||||
Thread to monitor a directory for new images.
|
||||
"""
|
||||
|
||||
handler = EventHandler(queue, loop)
|
||||
observer = Observer()
|
||||
observer.schedule(handler, str(path), recursive=recursive)
|
||||
observer.start()
|
||||
log.info(f"Monitoring for new images in '{path}'")
|
||||
while True:
|
||||
time.sleep(1)
|
||||
# stop when the app is exiting
|
||||
if app.state.exiting:
|
||||
observer.stop()
|
||||
observer.join(10)
|
||||
log.info(f"Stopping monitoring for new images in '{path}'")
|
||||
loop.call_soon_threadsafe(queue.put_nowait, None)
|
||||
break
|
||||
|
||||
queue = asyncio.Queue()
|
||||
loop = asyncio.get_event_loop()
|
||||
server_config = Config.instance().settings.Server
|
||||
image_dir = os.path.expanduser(server_config.images_path)
|
||||
asyncio.get_event_loop().run_in_executor(None, watchdog,image_dir, queue, loop, app, True)
|
||||
|
||||
async for filesystem_event in EventIterator(queue):
|
||||
# read the file system event from the queue
|
||||
image_path = filesystem_event.src_path
|
||||
expected_image_type = None
|
||||
if "IOU" in image_path:
|
||||
expected_image_type = "iou"
|
||||
elif "QEMU" in image_path:
|
||||
expected_image_type = "qemu"
|
||||
elif "IOS" in image_path:
|
||||
expected_image_type = "ios"
|
||||
async with AsyncSession(app.state._db_engine) as db_session:
|
||||
images_repository = ImagesRepository(db_session)
|
||||
try:
|
||||
image = await read_image_info(image_path, expected_image_type)
|
||||
except InvalidImageError as e:
|
||||
log.warning(str(e))
|
||||
continue
|
||||
try:
|
||||
if await images_repository.get_image(image_path):
|
||||
continue
|
||||
await images_repository.add_image(**image)
|
||||
log.info(f"Discovered image '{image_path}' has been added to the database")
|
||||
except SQLAlchemyError as e:
|
||||
log.warning(f"Error while adding image '{image_path}' to the database: {e}")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -147,7 +147,7 @@ class ServerSettings(BaseModel):
|
||||
allow_remote_console: bool = False
|
||||
enable_builtin_templates: bool = True
|
||||
install_builtin_appliances: bool = True
|
||||
model_config = ConfigDict(validate_assignment=True, str_strip_whitespace=True, use_enum_values=True)
|
||||
model_config = ConfigDict(validate_assignment=True, str_strip_whitespace=True)
|
||||
|
||||
@field_validator("additional_images_paths", mode="before")
|
||||
@classmethod
|
||||
|
||||
@@ -267,9 +267,9 @@ class Server:
|
||||
else:
|
||||
log.info(f"Compute authentication is enabled with username '{config.Server.compute_username}'")
|
||||
|
||||
# we only support Python 3 version >= 3.8
|
||||
if sys.version_info < (3, 8, 0):
|
||||
raise SystemExit("Python 3.8 or higher is required")
|
||||
# we only support Python 3 version >= 3.9
|
||||
if sys.version_info < (3, 9, 0):
|
||||
raise SystemExit("Python 3.9 or higher is required")
|
||||
|
||||
log.info(
|
||||
"Running with Python {major}.{minor}.{micro} and has PID {pid}".format(
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
# 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 jose import JWTError, jwt
|
||||
from joserfc import jwt
|
||||
from joserfc.jwk import OctKey
|
||||
from joserfc.errors import JoseError
|
||||
from datetime import datetime, timedelta, timezone
|
||||
import bcrypt
|
||||
|
||||
@@ -56,7 +57,8 @@ class AuthService:
|
||||
secret_key = DEFAULT_JWT_SECRET_KEY
|
||||
log.error("A JWT secret key must be configured to secure the server, using an unsecured default key!")
|
||||
algorithm = Config.instance().settings.Controller.jwt_algorithm
|
||||
encoded_jwt = jwt.encode(to_encode, secret_key, algorithm=algorithm)
|
||||
key = OctKey.import_key(secret_key)
|
||||
encoded_jwt = jwt.encode({"alg": algorithm}, to_encode, key)
|
||||
return encoded_jwt
|
||||
|
||||
def get_username_from_token(self, token: str, secret_key: str = None) -> Optional[str]:
|
||||
@@ -73,11 +75,12 @@ class AuthService:
|
||||
secret_key = DEFAULT_JWT_SECRET_KEY
|
||||
log.error("A JWT secret key must be configured to secure the server, using an unsecured default key!")
|
||||
algorithm = Config.instance().settings.Controller.jwt_algorithm
|
||||
payload = jwt.decode(token, secret_key, algorithms=[algorithm])
|
||||
username: str = payload.get("sub")
|
||||
key = OctKey.import_key(secret_key)
|
||||
payload = jwt.decode(token, key, algorithms=[algorithm])
|
||||
username: str = payload.claims.get("sub")
|
||||
if username is None:
|
||||
raise credentials_exception
|
||||
token_data = TokenData(username=username)
|
||||
except (JWTError, ValidationError):
|
||||
except (JoseError, ValidationError, ValueError):
|
||||
raise credentials_exception
|
||||
return token_data.username
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,2 @@
|
||||
/*! For license information please see swagger-ui-bundle.js.LICENSE.txt */
|
||||
!function webpackUniversalModuleDefinition(s,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports.SwaggerUIBundle=o():s.SwaggerUIBundle=o()}(this,(()=>(()=>{var s,o,i={69119:(s,o)=>{"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.BLANK_URL=o.relativeFirstCharacters=o.whitespaceEscapeCharsRegex=o.urlSchemeRegex=o.ctrlCharactersRegex=o.htmlCtrlEntityRegex=o.htmlEntitiesRegex=o.invalidProtocolRegex=void 0,o.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,o.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,o.htmlCtrlEntityRegex=/&(newline|tab);/gi,o.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,o.urlSchemeRegex=/^.+(:|:)/gim,o.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,o.relativeFirstCharacters=[".","/"],o.BLANK_URL="about:blank"},16750:(s,o,i)=>{"use strict";o.J=void 0;var u=i(69119);function decodeURI(s){try{return decodeURIComponent(s)}catch(o){return s}}o.J=function sanitizeUrl(s){if(!s)return u.BLANK_URL;var o,i,_=decodeURI(s);do{o=(_=decodeURI(_=(i=_,i.replace(u.ctrlCharactersRegex,"").replace(u.htmlEntitiesRegex,(function(s,o){return String.fromCharCode(o)}))).replace(u.htmlCtrlEntityRegex,"").replace(u.ctrlCharactersRegex,"").replace(u.whitespaceEscapeCharsRegex,"").trim())).match(u.ctrlCharactersRegex)||_.match(u.htmlEntitiesRegex)||_.match(u.htmlCtrlEntityRegex)||_.match(u.whitespaceEscapeCharsRegex)}while(o&&o.length>0);var w=_;if(!w)return u.BLANK_URL;if(function isRelativeUrlWithoutProtocol(s){return u.relativeFirstCharacters.indexOf(s[0])>-1}(w))return w;var x=w.match(u.urlSchemeRegex);if(!x)return w;var C=x[0];return u.invalidProtocolRegex.test(C)?u.BLANK_URL:w}},67526:(s,o)=>{"use strict";o.byteLength=function byteLength(s){var o=getLens(s),i=o[0],u=o[1];return 3*(i+u)/4-u},o.toByteArray=function toByteArray(s){var o,i,w=getLens(s),x=w[0],C=w[1],j=new _(function _byteLength(s,o,i){return 3*(o+i)/4-i}(0,x,C)),L=0,B=C>0?x-4:x;for(i=0;i<B;i+=4)o=u[s.charCodeAt(i)]<<18|u[s.charCodeAt(i+1)]<<12|u[s.charCodeAt(i+2)]<<6|u[s.charCodeAt(i+3)],j[L++]=o>>16&255,j[L++]=o>>8&255,j[L++]=255&o;2===C&&(o=u[s.charCodeAt(i)]<<2|u[s.charCodeAt(i+1)]>>4,j[L++]=255&o);1===C&&(o=u[s.charCodeAt(i)]<<10|u[s.charCodeAt(i+1)]<<4|u[s.charCodeAt(i+2)]>>2,j[L++]=o>>8&255,j[L++]=255&o);return j},o.fromByteArray=function fromByteArray(s){for(var o,u=s.length,_=u%3,w=[],x=16383,C=0,j=u-_;C<j;C+=x)w.push(encodeChunk(s,C,C+x>j?j:C+x));1===_?(o=s[u-1],w.push(i[o>>2]+i[o<<4&63]+"==")):2===_&&(o=(s[u-2]<<8)+s[u-1],w.push(i[o>>10]+i[o>>4&63]+i[o<<2&63]+"="));return w.join("")};for(var i=[],u=[],_="undefined"!=typeof Uint8Array?Uint8Array:Array,w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=0;x<64;++x)i[x]=w[x],u[w.charCodeAt(x)]=x;function getLens(s){var o=s.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var i=s.indexOf("=");return-1===i&&(i=o),[i,i===o?0:4-i%4]}function encodeChunk(s,o,u){for(var _,w,x=[],C=o;C<u;C+=3)_=(s[C]<<16&16711680)+(s[C+1]<<8&65280)+(255&s[C+2]),x.push(i[(w=_)>>18&63]+i[w>>12&63]+i[w>>6&63]+i[63&w]);return x.join("")}u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63},48287:(s,o,i)=>{"use strict";const u=i(67526),_=i(251),w="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=Buffer,o.SlowBuffer=function SlowBuffer(s){+s!=s&&(s=0);return Buffer.alloc(+s)},o.INSPECT_MAX_BYTES=50;const x=2147483647;function createBuffer(s){if(s>x)throw new RangeError('The value "'+s+'" is invalid for option "size"');const o=new Uint8Array(s);return Object.setPrototypeOf(o,Buffer.prototype),o}function Buffer(s,o,i){if("number"==typeof s){if("string"==typeof o)throw new TypeError('The "string" argument must be of type string. Received type number');return allocUnsafe(s)}return from(s,o,i)}function from(s,o,i){if("string"==typeof s)return function fromString(s,o){"string"==typeof o&&""!==o||(o="utf8");if(!Buffer.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const i=0|byteLength(s,o);let u=createBuffer(i);const _=u.write(s,o);_!==i&&(u=u.slice(0,_));return u}(s,o);if(ArrayBuffer.isView(s))return function fromArrayView(s){if(isInstance(s,Uint8Array)){const o=new Uint8Array(s);return fromArrayBuffer(o.buffer,o.byteOffset,o.byteLength)}return fromArrayLike(s)}(s);if(null==s)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if(isInstance(s,ArrayBuffer)||s&&isInstance(s.buffer,ArrayBuffer))return fromArrayBuffer(s,o,i);if("undefined"!=typeof SharedArrayBuffer&&(isInstance(s,SharedArrayBuffer)||s&&isInstance(s.buffer,SharedArrayBuffer)))return fromArrayBuffer(s,o,i);if("number"==typeof s)throw new TypeError('The "value" argument must not be of type number. Received type number');const u=s.valueOf&&s.valueOf();if(null!=u&&u!==s)return Buffer.from(Line truncated
|
||||
@@ -0,0 +1,3 @@
|
||||
.swagger-ui{color:#3b4151;font-family:sans-serif/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */}.swagger-ui html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}.swagger-ui body{margin:0}.swagger-ui article,.swagger-ui aside,.swagger-ui footer,.swagger-ui header,.swagger-ui nav,.swagger-ui section{display:block}.swagger-ui h1{font-size:2em;margin:.67em 0}.swagger-ui figcaption,.swagger-ui figure,.swagger-ui main{display:block}.swagger-ui figure{margin:1em 40px}.swagger-ui hr{box-sizing:content-box;height:0;overflow:visible}.swagger-ui pre{font-family:monospace,monospace;font-size:1em}.swagger-ui a{background-color:transparent;-webkit-text-decoration-skip:objects}.swagger-ui abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.swagger-ui b,.swagger-ui strong{font-weight:inherit;font-weight:bolder}.swagger-ui code,.swagger-ui kbd,.swagger-ui samp{font-family:monospace,monospace;font-size:1em}.swagger-ui dfn{font-style:italic}.swagger-ui mark{background-color:#ff0;color:#000}.swagger-ui small{font-size:80%}.swagger-ui sub,.swagger-ui sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.swagger-ui sub{bottom:-.25em}.swagger-ui sup{top:-.5em}.swagger-ui audio,.swagger-ui video{display:inline-block}.swagger-ui audio:not([controls]){display:none;height:0}.swagger-ui img{border-style:none}.swagger-ui svg:not(:root){overflow:hidden}.swagger-ui button,.swagger-ui input,.swagger-ui optgroup,.swagger-ui select,.swagger-ui textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}.swagger-ui button,.swagger-ui input{overflow:visible}.swagger-ui button,.swagger-ui select{text-transform:none}.swagger-ui [type=reset],.swagger-ui [type=submit],.swagger-ui button,.swagger-ui html [type=button]{-webkit-appearance:button}.swagger-ui [type=button]::-moz-focus-inner,.swagger-ui [type=reset]::-moz-focus-inner,.swagger-ui [type=submit]::-moz-focus-inner,.swagger-ui button::-moz-focus-inner{border-style:none;padding:0}.swagger-ui [type=button]:-moz-focusring,.swagger-ui [type=reset]:-moz-focusring,.swagger-ui [type=submit]:-moz-focusring,.swagger-ui button:-moz-focusring{outline:1px dotted ButtonText}.swagger-ui fieldset{padding:.35em .75em .625em}.swagger-ui legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}.swagger-ui progress{display:inline-block;vertical-align:baseline}.swagger-ui textarea{overflow:auto}.swagger-ui [type=checkbox],.swagger-ui [type=radio]{box-sizing:border-box;padding:0}.swagger-ui [type=number]::-webkit-inner-spin-button,.swagger-ui [type=number]::-webkit-outer-spin-button{height:auto}.swagger-ui [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.swagger-ui [type=search]::-webkit-search-cancel-button,.swagger-ui [type=search]::-webkit-search-decoration{-webkit-appearance:none}.swagger-ui ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.swagger-ui details,.swagger-ui menu{display:block}.swagger-ui summary{display:list-item}.swagger-ui canvas{display:inline-block}.swagger-ui [hidden],.swagger-ui template{display:none}.swagger-ui .debug *{outline:1px solid gold}.swagger-ui .debug-white *{outline:1px solid #fff}.swagger-ui .debug-black *{outline:1px solid #000}.swagger-ui .debug-grid{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTExIDc5LjE1ODMyNSwgMjAxNS8wOS8xMC0wMToxMDoyMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MTRDOTY4N0U2N0VFMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MTRDOTY4N0Q2N0VFMTFFNjg2MzZDQjkwNkQ4MjgwMEIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTUgKE1hY2ludG9zaCkiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo3NjcyQkQ3NjY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo3NjcyQkQ3NzY3QzUxMUU2QjJCQ0UyNDA4MTAwMjE3MSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PsBS+GMAAAAjSURBVHjaYvz//z8DLsD4gcGXiYEAGBIKGBne//fFpwAgwAB98AaF2pjlUQAAAABJRU5ErkJggg==) repeat 0 0}.swagger-ui .debug-grid-16{background:transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+ILine truncated
|
||||
|
||||
/*# sourceMappingURL=swagger-ui.css.map*/
|
||||
@@ -46,6 +46,6 @@
|
||||
|
||||
gtag('config', 'G-0BT7QQV1W1');
|
||||
</script>
|
||||
<script src="runtime.24fa95b7061d7056.js" type="module"></script><script src="polyfills.319c79dd175e50d0.js" type="module"></script><script src="main.ed82697b58d803e7.js" type="module"></script>
|
||||
<script src="runtime.24fa95b7061d7056.js" type="module"></script><script src="polyfills.319c79dd175e50d0.js" type="module"></script><script src="main.62c99707e4709a56.js" type="module"></script>
|
||||
|
||||
</body></html>
|
||||
@@ -0,0 +1 @@
|
||||
(self.webpackChunkgns3_web_ui=self.webpackChunkgns3_web_ui||[]).push([[179],{5735:function(De,K,m){"use strict";m.d(K,{o:function(){return R}});var G=m(5671),W=m(3144),A=m(591),U=m(8929),R=function(){function P(){(0,G.Z)(this,P),this.data=[],this.dataChange=new A.X([]),this.itemUpdated=new U.xQ}return(0,W.Z)(P,[{key:"getItems",value:function(){return this.data}},{key:"add",value:function(D){this.findIndex(D)>=0?this.update(D):(this.data.push(D),this.dataChange.next(this.data))}},{key:"set",value:function(D){var j=this;D.forEach(function(v){var k=j.findIndex(v);if(k>=0){var b=Object.assign(j.data[k],v);j.data[k]=b}else j.data.push(v)}),this.data.filter(function(v){return 0===D.filter(function(k){return j.getItemKey(k)===j.getItemKey(v)}).length}).forEach(function(v){return j.remove(v)}),this.dataChange.next(this.data)}},{key:"get",value:function(D){var j=this,L=this.data.findIndex(function(v){return j.getItemKey(v)===D});if(L>=0)return this.data[L]}},{key:"update",value:function(D){var j=this.findIndex(D);if(j>=0){var L=Object.assign(this.data[j],D);this.data[j]=L,this.dataChange.next(this.data),this.itemUpdated.next(L)}}},{key:"remove",value:function(D){var j=this.findIndex(D);j>=0&&(this.data.splice(j,1),this.dataChange.next(this.data))}},{key:"changes",get:function(){return this.dataChange}},{key:"itemChanged",get:function(){return this.itemUpdated}},{key:"clear",value:function(){this.data=[],this.dataChange.next(this.data)}},{key:"findIndex",value:function(D){var j=this;return this.data.findIndex(function(L){return j.getItemKey(L)===j.getItemKey(D)})}}]),P}()},6215:function(De,K,m){"use strict";m.d(K,{F:function(){return E}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5735),P=m(5e3),E=function(D){(0,A.Z)(L,D);var j=(0,U.Z)(L);function L(){return(0,G.Z)(this,L),j.apply(this,arguments)}return(0,W.Z)(L,[{key:"getItemKey",value:function(k){return k.link_id}}]),L}(R.o);E.\u0275fac=function(){var D;return function(L){return(D||(D=P.n5z(E)))(L||E)}}(),E.\u0275prov=P.Yz7({token:E,factory:E.\u0275fac})},5366:function(De,K,m){"use strict";m.d(K,{G:function(){return E}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5735),P=m(5e3),E=function(D){(0,A.Z)(L,D);var j=(0,U.Z)(L);function L(){return(0,G.Z)(this,L),j.apply(this,arguments)}return(0,W.Z)(L,[{key:"getItemKey",value:function(k){return k.node_id}}]),L}(R.o);E.\u0275fac=function(){var D;return function(L){return(D||(D=P.n5z(E)))(L||E)}}(),E.\u0275prov=P.Yz7({token:E,factory:E.\u0275fac})},5542:function(De,K,m){"use strict";m.d(K,{X:function(){return R}});var G=m(5671),W=m(3144),A=m(5e3),U=m(2437),R=function(){function P(E){(0,G.Z)(this,P),this.httpController=E}return(0,W.Z)(P,[{key:"getComputes",value:function(D){return this.httpController.get(D,"/computes")}},{key:"getStatistics",value:function(D){return this.httpController.get(D,"/statistics")}}]),P}();R.\u0275fac=function(E){return new(E||R)(A.LFG(U.zw))},R.\u0275prov=A.Yz7({token:R,factory:R.\u0275fac})},2437:function(De,K,m){"use strict";m.d(K,{CJ:function(){return k},zw:function(){return b}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5724),P=m(5e3),E=m(4766),D=m(1737),j=m(7221),L=m(520),v=function(O){(0,A.Z)(y,O);var S=(0,U.Z)(y);function y(T){return(0,G.Z)(this,y),S.call(this,T)}return(0,W.Z)(y,null,[{key:"fromError",value:function(M,x){var N=new y(M);return N.originalError=x,N}}]),y}((0,R.Z)(Error)),k=function(){function O(){(0,G.Z)(this,O)}return(0,W.Z)(O,[{key:"handleError",value:function(y){var T=y;return"HttpErrorResponse"===y.name&&0===y.status&&(T=v.fromError("Controller is unreachable",y)),401===y.status&&window.location.reload(),(0,D._)(T)}}]),O}();k.\u0275fac=function(S){return new(S||k)},k.\u0275prov=P.Yz7({token:k,factory:k.\u0275fac});var b=function(){function O(S,y){(0,G.Z)(this,O),this.http=S,this.errorHandler=y,this.requestsNotificationEmitter=new P.vpe}return(0,W.Z)(O,[{key:"get",value:function(y,T,M){M=this.getJsonOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"getText",value:function(y,T,M){M=this.getTextOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"getBlob",value:function(y,T,M){M=this.getBlobOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"post",value:function(y,T,M,x){x=this.getJsonOptions(x);var N=this.getOptionsForController(y,T,x);return this.requestsNotificationEmitter.emit("POST ".concat(N.url)),this.http.post(N.url,M,N.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"put",value:function(y,T,M,x){x=this.getJsonOptions(x);var N=this.getOptionsForController(y,T,x);return this.requestsNotificationLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
(self.webpackChunkgns3_web_ui=self.webpackChunkgns3_web_ui||[]).push([[179],{5735:function(De,K,m){"use strict";m.d(K,{o:function(){return R}});var G=m(5671),W=m(3144),A=m(591),U=m(8929),R=function(){function P(){(0,G.Z)(this,P),this.data=[],this.dataChange=new A.X([]),this.itemUpdated=new U.xQ}return(0,W.Z)(P,[{key:"getItems",value:function(){return this.data}},{key:"add",value:function(D){this.findIndex(D)>=0?this.update(D):(this.data.push(D),this.dataChange.next(this.data))}},{key:"set",value:function(D){var j=this;D.forEach(function(v){var k=j.findIndex(v);if(k>=0){var b=Object.assign(j.data[k],v);j.data[k]=b}else j.data.push(v)}),this.data.filter(function(v){return 0===D.filter(function(k){return j.getItemKey(k)===j.getItemKey(v)}).length}).forEach(function(v){return j.remove(v)}),this.dataChange.next(this.data)}},{key:"get",value:function(D){var j=this,L=this.data.findIndex(function(v){return j.getItemKey(v)===D});if(L>=0)return this.data[L]}},{key:"update",value:function(D){var j=this.findIndex(D);if(j>=0){var L=Object.assign(this.data[j],D);this.data[j]=L,this.dataChange.next(this.data),this.itemUpdated.next(L)}}},{key:"remove",value:function(D){var j=this.findIndex(D);j>=0&&(this.data.splice(j,1),this.dataChange.next(this.data))}},{key:"changes",get:function(){return this.dataChange}},{key:"itemChanged",get:function(){return this.itemUpdated}},{key:"clear",value:function(){this.data=[],this.dataChange.next(this.data)}},{key:"findIndex",value:function(D){var j=this;return this.data.findIndex(function(L){return j.getItemKey(L)===j.getItemKey(D)})}}]),P}()},6215:function(De,K,m){"use strict";m.d(K,{F:function(){return E}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5735),P=m(5e3),E=function(D){(0,A.Z)(L,D);var j=(0,U.Z)(L);function L(){return(0,G.Z)(this,L),j.apply(this,arguments)}return(0,W.Z)(L,[{key:"getItemKey",value:function(k){return k.link_id}}]),L}(R.o);E.\u0275fac=function(){var D;return function(L){return(D||(D=P.n5z(E)))(L||E)}}(),E.\u0275prov=P.Yz7({token:E,factory:E.\u0275fac})},5366:function(De,K,m){"use strict";m.d(K,{G:function(){return E}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5735),P=m(5e3),E=function(D){(0,A.Z)(L,D);var j=(0,U.Z)(L);function L(){return(0,G.Z)(this,L),j.apply(this,arguments)}return(0,W.Z)(L,[{key:"getItemKey",value:function(k){return k.node_id}}]),L}(R.o);E.\u0275fac=function(){var D;return function(L){return(D||(D=P.n5z(E)))(L||E)}}(),E.\u0275prov=P.Yz7({token:E,factory:E.\u0275fac})},5542:function(De,K,m){"use strict";m.d(K,{X:function(){return P}});var G=m(5671),W=m(3144),A=m(4766),U=m(5e3),R=m(2437),P=function(){function E(D){(0,G.Z)(this,E),this.httpController=D}return(0,W.Z)(E,[{key:"getComputes",value:function(j){return this.httpController.get(j,"/computes")}},{key:"getUploadPath",value:function(j,L,v){return"".concat(j.protocol,"//").concat(j.host,":").concat(j.port,"/").concat(A.N.current_version,"/").concat(L,"/images/").concat(v)}},{key:"getStatistics",value:function(j){return this.httpController.get(j,"/statistics")}}]),E}();P.\u0275fac=function(D){return new(D||P)(U.LFG(R.zw))},P.\u0275prov=U.Yz7({token:P,factory:P.\u0275fac})},2437:function(De,K,m){"use strict";m.d(K,{CJ:function(){return k},zw:function(){return b}});var G=m(5671),W=m(3144),A=m(136),U=m(9388),R=m(5724),P=m(5e3),E=m(4766),D=m(1737),j=m(7221),L=m(520),v=function(O){(0,A.Z)(y,O);var S=(0,U.Z)(y);function y(T){return(0,G.Z)(this,y),S.call(this,T)}return(0,W.Z)(y,null,[{key:"fromError",value:function(M,x){var N=new y(M);return N.originalError=x,N}}]),y}((0,R.Z)(Error)),k=function(){function O(){(0,G.Z)(this,O)}return(0,W.Z)(O,[{key:"handleError",value:function(y){var T=y;return"HttpErrorResponse"===y.name&&0===y.status&&(T=v.fromError("Controller is unreachable",y)),401===y.status&&window.location.reload(),(0,D._)(T)}}]),O}();k.\u0275fac=function(S){return new(S||k)},k.\u0275prov=P.Yz7({token:k,factory:k.\u0275fac});var b=function(){function O(S,y){(0,G.Z)(this,O),this.http=S,this.errorHandler=y,this.requestsNotificationEmitter=new P.vpe}return(0,W.Z)(O,[{key:"get",value:function(y,T,M){M=this.getJsonOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"getText",value:function(y,T,M){M=this.getTextOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"getBlob",value:function(y,T,M){M=this.getBlobOptions(M);var x=this.getOptionsForController(y,T,M);return this.requestsNotificationEmitter.emit("GET ".concat(x.url)),this.http.get(x.url,x.options).pipe((0,j.K)(this.errorHandler.handleError))}},{key:"post",value:function(y,T,M,x){x=this.getJsonOptions(x);var N=this.getOptionsForController(y,T,x);return this.requestsNotificationEmitter.emit("POST ".concat(N.url)),this.http.post(N.url,M,N.oLine truncated
|
||||
@@ -97,18 +97,10 @@ async def wait_for_process_termination(process, timeout=10):
|
||||
:param timeout: Timeout in seconds
|
||||
"""
|
||||
|
||||
if sys.version_info >= (3, 5):
|
||||
try:
|
||||
await asyncio.wait_for(process.wait(), timeout=timeout)
|
||||
except ProcessLookupError:
|
||||
return
|
||||
else:
|
||||
while timeout > 0:
|
||||
if process.returncode is not None:
|
||||
return
|
||||
await asyncio.sleep(0.1)
|
||||
timeout -= 0.1
|
||||
raise asyncio.TimeoutError()
|
||||
try:
|
||||
await asyncio.wait_for(process.wait(), timeout=timeout)
|
||||
except ProcessLookupError:
|
||||
return
|
||||
|
||||
|
||||
async def _check_process(process, termination_callback):
|
||||
|
||||
@@ -40,10 +40,7 @@ class Pool:
|
||||
while len(self._tasks) > 0 or len(pending) > 0:
|
||||
while len(self._tasks) > 0 and len(pending) < self._concurrency:
|
||||
task, args, kwargs = self._tasks.pop(0)
|
||||
if sys.version_info >= (3, 7):
|
||||
t = asyncio.create_task(task(*args, **kwargs))
|
||||
else:
|
||||
t = asyncio.get_event_loop().create_task(task(*args, **kwargs))
|
||||
t = asyncio.create_task(task(*args, **kwargs))
|
||||
pending.add(t)
|
||||
(done, pending) = await asyncio.wait(pending, return_when=asyncio.FIRST_COMPLETED)
|
||||
for task in done:
|
||||
|
||||
+61
-38
@@ -20,6 +20,11 @@ import stat
|
||||
import aiofiles
|
||||
import shutil
|
||||
|
||||
try:
|
||||
import importlib_resources
|
||||
except ImportError:
|
||||
from importlib import resources as importlib_resources
|
||||
|
||||
from typing import List, AsyncGenerator
|
||||
from ..config import Config
|
||||
from . import force_unix_path
|
||||
@@ -62,45 +67,63 @@ async def list_images(image_type):
|
||||
directory = os.path.normpath(directory)
|
||||
for root, _, filenames in _os_walk(directory, recurse=recurse):
|
||||
for filename in filenames:
|
||||
if filename not in files:
|
||||
if filename.endswith(".md5sum") or filename.startswith("."):
|
||||
if filename in files:
|
||||
log.debug("File {} has already been found, skipping...".format(filename))
|
||||
continue
|
||||
if filename.endswith(".md5sum") or filename.startswith("."):
|
||||
continue
|
||||
|
||||
files.add(filename)
|
||||
|
||||
# It the image is located in the standard directory the path is relative
|
||||
if os.path.commonprefix([root, default_directory]) != default_directory:
|
||||
path = os.path.join(root, filename)
|
||||
else:
|
||||
path = os.path.relpath(os.path.join(root, filename), default_directory)
|
||||
|
||||
filesize = os.stat(os.path.join(root, filename)).st_size
|
||||
if filesize < 7:
|
||||
log.debug(f"File {filename} is too small to be an image, skipping...")
|
||||
continue
|
||||
|
||||
try:
|
||||
with open(os.path.join(root, filename), "rb") as f:
|
||||
# read the first 7 bytes of the file.
|
||||
elf_header_start = f.read(7)
|
||||
if image_type == "dynamips" and elf_header_start != b'\x7fELF\x01\x02\x01':
|
||||
# IOS images must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
||||
log.warning(f"IOS image {filename} does not start with a valid ELF magic number, skipping...")
|
||||
continue
|
||||
elif image_type == "iou" and elf_header_start != b'\x7fELF\x02\x01\x01' and elf_header_start != b'\x7fELF\x01\x01\x01':
|
||||
# IOU images must start with the ELF magic number, be 32-bit or 64-bit, little endian and have an ELF version of 1
|
||||
log.warning(f"IOU image {filename} does not start with a valid ELF magic number, skipping...")
|
||||
continue
|
||||
elif image_type == "qemu" and elf_header_start[:4] == b'\x7fELF':
|
||||
# QEMU images should not start with an ELF magic number
|
||||
log.warning(f"QEMU image {filename} starts with an ELF magic number, skipping...")
|
||||
continue
|
||||
elif (
|
||||
((filename.endswith(".image") or filename.endswith(".bin")) and image_type == "dynamips")
|
||||
or ((filename.endswith(".bin") or filename.startswith("i86bi")) and image_type == "iou")
|
||||
or (not filename.endswith(".bin") and not filename.endswith(".image") and image_type == "qemu")
|
||||
):
|
||||
files.add(filename)
|
||||
|
||||
# It the image is located in the standard directory the path is relative
|
||||
if os.path.commonprefix([root, default_directory]) != default_directory:
|
||||
path = os.path.join(root, filename)
|
||||
else:
|
||||
path = os.path.relpath(os.path.join(root, filename), default_directory)
|
||||
|
||||
try:
|
||||
if image_type in ["dynamips", "iou"]:
|
||||
with open(os.path.join(root, filename), "rb") as f:
|
||||
# read the first 7 bytes of the file.
|
||||
elf_header_start = f.read(7)
|
||||
# valid IOU or IOS images must start with the ELF magic number, be 32-bit or 64-bit,
|
||||
# little endian and have an ELF version of 1
|
||||
if elf_header_start != b'\x7fELF\x02\x01\x01' and elf_header_start != b'\x7fELF\x01\x01\x01':
|
||||
continue
|
||||
|
||||
images.append(
|
||||
{
|
||||
"filename": filename,
|
||||
"path": force_unix_path(path),
|
||||
"md5sum": await wait_run_in_executor(md5sum, os.path.join(root, filename)),
|
||||
"filesize": os.stat(os.path.join(root, filename)).st_size,
|
||||
}
|
||||
)
|
||||
except OSError as e:
|
||||
log.warning(f"Can't add image {path}: {str(e)}")
|
||||
images.append(
|
||||
{
|
||||
"filename": filename,
|
||||
"path": force_unix_path(path),
|
||||
"md5sum": await wait_run_in_executor(md5sum, os.path.join(root, filename)),
|
||||
"filesize": filesize,
|
||||
}
|
||||
)
|
||||
except OSError as e:
|
||||
log.warning(f"Can't add image {path}: {str(e)}")
|
||||
return images
|
||||
|
||||
|
||||
def get_builtin_disks() -> List[str]:
|
||||
builtin_disks = []
|
||||
for entry in importlib_resources.files('gns3server').joinpath("disks").iterdir():
|
||||
if entry.is_file():
|
||||
builtin_disks.append(entry.name)
|
||||
return builtin_disks
|
||||
|
||||
|
||||
async def read_image_info(path: str, expected_image_type: str = None) -> dict:
|
||||
|
||||
header_magic_len = 7
|
||||
@@ -108,7 +131,7 @@ async def read_image_info(path: str, expected_image_type: str = None) -> dict:
|
||||
async with aiofiles.open(path, "rb") as f:
|
||||
image_header = await f.read(header_magic_len) # read the first 7 bytes of the file
|
||||
if len(image_header) >= header_magic_len:
|
||||
detected_image_type = check_valid_image_header(image_header)
|
||||
detected_image_type = check_valid_image_header(path, image_header)
|
||||
if expected_image_type and detected_image_type != expected_image_type:
|
||||
raise InvalidImageError(f"Detected image type for '{path}' is {detected_image_type}, "
|
||||
f"expected type is {expected_image_type}")
|
||||
@@ -292,7 +315,7 @@ class InvalidImageError(Exception):
|
||||
return self._message
|
||||
|
||||
|
||||
def check_valid_image_header(data: bytes, allow_raw_image: bool = False) -> str:
|
||||
def check_valid_image_header(path: str, data: bytes, allow_raw_image: bool = False) -> str:
|
||||
|
||||
if data[:7] == b'\x7fELF\x01\x02\x01':
|
||||
# for IOS images: file must start with the ELF magic number, be 32-bit, big endian and have an ELF version of 1
|
||||
@@ -307,7 +330,7 @@ def check_valid_image_header(data: bytes, allow_raw_image: bool = False) -> str:
|
||||
else:
|
||||
if allow_raw_image is True:
|
||||
return "qemu"
|
||||
raise InvalidImageError("Could not detect image type, please make sure it is a valid image")
|
||||
raise InvalidImageError(f"{path}: could not detect image type, please make sure it is a valid image")
|
||||
|
||||
|
||||
async def write_image(
|
||||
@@ -332,7 +355,7 @@ async def write_image(
|
||||
async for chunk in stream:
|
||||
if check_image_header and len(chunk) >= header_magic_len:
|
||||
check_image_header = False
|
||||
image_type = check_valid_image_header(chunk, allow_raw_image)
|
||||
image_type = check_valid_image_header(image_path, chunk, allow_raw_image)
|
||||
await f.write(chunk)
|
||||
checksum.update(chunk)
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
# or negative for a release candidate or beta (after the base version
|
||||
# number has been incremented)
|
||||
|
||||
__version__ = "3.0.0rc2"
|
||||
__version_info__ = (3, 0, 0, -99)
|
||||
__version__ = "3.0.2"
|
||||
__version_info__ = (3, 0, 2, 0)
|
||||
|
||||
if "dev" in __version__:
|
||||
try:
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ authors = [
|
||||
{ name = "Jeremy Grossmann", email = "developers@gns3.com" }
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.8"
|
||||
requires-python = ">=3.9"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Environment :: Console",
|
||||
@@ -21,11 +21,11 @@ classifiers = [
|
||||
"Natural Language :: English",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: Implementation :: CPython"
|
||||
]
|
||||
|
||||
|
||||
+14
-13
@@ -1,23 +1,24 @@
|
||||
uvicorn==0.32.0
|
||||
pydantic==2.9.2
|
||||
fastapi==0.115.5
|
||||
python-multipart==0.0.16
|
||||
websockets==13.1
|
||||
uvicorn==0.33.0 # uvicorn 0.33 is the last version supporting Python 3.8
|
||||
pydantic==2.10.4
|
||||
fastapi==0.115.6
|
||||
python-multipart==0.0.20
|
||||
websockets==14.1
|
||||
aiohttp>=3.10.10,<3.11
|
||||
async-timeout==4.0.3
|
||||
async-timeout==5.0.1; python_version < '3.11'
|
||||
aiofiles>=24.1.0,<25.0
|
||||
Jinja2>=3.1.4,<3.2
|
||||
sentry-sdk>=2.17,<2.18 # optional dependency
|
||||
psutil>=6.1.0
|
||||
Jinja2>=3.1.5,<3.2
|
||||
sentry-sdk>=2.19.2,<2.20 # optional dependency
|
||||
psutil>=6.1.1
|
||||
distro>=1.9.0
|
||||
py-cpuinfo>=9.0.0,<10.0
|
||||
greenlet==3.1.1 # necessary to run sqlalchemy on Python 3.13
|
||||
sqlalchemy==2.0.36
|
||||
aiosqlite==0.20.0
|
||||
alembic==1.13.3
|
||||
bcrypt==4.2.0
|
||||
python-jose[cryptography]==3.3.0
|
||||
alembic==1.14.0
|
||||
bcrypt==4.2.1
|
||||
joserfc==1.0.1
|
||||
email-validator==2.2.0
|
||||
watchfiles==0.24.0
|
||||
watchdog==6.0.0
|
||||
zstandard==0.23.0
|
||||
platformdirs>=2.4.0,<3 # platformdirs >=3 conflicts when building Debian packages
|
||||
importlib-resources>=1.3; python_version <= '3.9'
|
||||
|
||||
+108
-155
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2015 GNS3 Technologies Inc.
|
||||
# Copyright (C) 2024 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
|
||||
@@ -16,19 +16,20 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# Install GNS3 on a remote Ubuntu LTS server
|
||||
# This create a dedicated user and setup all the package
|
||||
# and optionnaly a VPN
|
||||
# Install GNS3 on a remote Ubuntu server
|
||||
# This creates a dedicated user and setup all the packages
|
||||
# and optionally a VPN
|
||||
#
|
||||
|
||||
function help {
|
||||
echo "Usage:" >&2
|
||||
echo "--with-openvpn: Install OpenVPN" >&2
|
||||
echo "--with-iou: Install IOU" >&2
|
||||
echo "--with-i386-repository: Add the i386 repositories required by IOU if they are not already available on the system. Warning: this will replace your source.list in order to use the official Ubuntu mirror" >&2
|
||||
echo "--with-iou: Install IOU support" >&2
|
||||
echo "--with-i386-repository: Add the i386 repositories required by IOU i386 images. This is not needed for recent x86_64 IOU images." >&2
|
||||
echo "--with-welcome: Install GNS3-VM welcome.py script" >&2
|
||||
echo "--without-kvm: Disable KVM, required if system do not support it (limitation in some hypervisors and cloud providers). Warning: only disable KVM if strictly necessary as this will degrade performance" >&2
|
||||
echo "--unstable: Use the GNS3 unstable repository"
|
||||
echo "--unstable: Use the GNS3 unstable repository" >&2
|
||||
echo "--custom-repository <repository>: Use a custom repository" >&2
|
||||
echo "--help: This help" >&2
|
||||
}
|
||||
|
||||
@@ -43,15 +44,17 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Default repository
|
||||
REPOSITORY="ppa"
|
||||
|
||||
# Read the options
|
||||
USE_VPN=0
|
||||
USE_IOU=0
|
||||
I386_REPO=0
|
||||
DISABLE_KVM=0
|
||||
UNSTABLE=0
|
||||
WELCOME_SETUP=0
|
||||
|
||||
TEMP=`getopt -o h --long with-openvpn,with-iou,with-i386-repository,with-welcome,without-kvm,unstable,help -n 'gns3-remote-install.sh' -- "$@"`
|
||||
TEMP=`getopt -o h --long with-openvpn,with-iou,with-i386-repository,with-welcome,without-kvm,unstable,custom-repository:,help -n 'gns3-remote-install.sh' -- "$@"`
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
help
|
||||
@@ -83,9 +86,13 @@ while true ; do
|
||||
shift
|
||||
;;
|
||||
--unstable)
|
||||
UNSTABLE=1
|
||||
REPOSITORY="unstable"
|
||||
shift
|
||||
;;
|
||||
--custom-repository)
|
||||
REPOSITORY="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
help
|
||||
exit 1
|
||||
@@ -103,91 +110,93 @@ UBUNTU_CODENAME=`lsb_release -c -s`
|
||||
|
||||
log "Add GNS3 repository"
|
||||
|
||||
if [ "$UBUNTU_CODENAME" == "trusty" ]
|
||||
if [ ! -f "/etc/apt/sources.list.d/ubuntu.sources" ]
|
||||
then
|
||||
if [ $UNSTABLE == 1 ]
|
||||
then
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
|
||||
deb http://ppa.launchpad.net/gns3/unstable/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/unstable/ubuntu $UBUNTU_CODENAME main
|
||||
deb http://ppa.launchpad.net/gns3/qemu/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/qemu/ubuntu $UBUNTU_CODENAME main
|
||||
EOFLIST
|
||||
else
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B83AAABFFBD82D21B543C8EA86C22C2EC6A24D7F
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
|
||||
deb http://ppa.launchpad.net/gns3/ppa/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/ppa/ubuntu $UBUNTU_CODENAME main
|
||||
deb http://ppa.launchpad.net/gns3/qemu/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/qemu/ubuntu $UBUNTU_CODENAME main
|
||||
EOFLIST
|
||||
fi
|
||||
|
||||
else
|
||||
if [ $UNSTABLE == 1 ]
|
||||
then
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
|
||||
deb http://ppa.launchpad.net/gns3/unstable/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/unstable/ubuntu $UBUNTU_CODENAME main
|
||||
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3-ppa.sources
|
||||
Types: deb
|
||||
URIs: https://ppa.launchpadcontent.net/gns3/$REPOSITORY/ubuntu/
|
||||
Suites: $UBUNTU_CODENAME
|
||||
Components: main
|
||||
Signed-By:
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
.
|
||||
mQINBGY0jSYBEADMH5CvX8ZVX4XzAxdQ2CmF7t86IjFnQgtI18Q19nVnpKEGNyB5
|
||||
pgotDMzkhGnxuhvz2zE9PZhd8VgkodB81V607d/Dy8FfI7t1BVQhLvJDx0H/q6RE
|
||||
n2y9WxiuBzTHitoQTCTY3hjcr7AUNFFI64gUqwbkQmYbCWWsYOlDpRSkWKg8P8WK
|
||||
08RetwTI0Iwoz8j+BkbPlubuImiVfh1TeH23FBuGIwL1r1Cps0wel6JAi+jaU9WG
|
||||
j8MX3mQYFTAtk7f1lRubqWosB/A4xIu609pF1e1tAkWAGltYAeoFhDn+PfA9KgmV
|
||||
fvxfVR7zmxp31imTJgXgUFCz+H0Xb3vpve8XsrsHZUP6StJ3+6cFXjNBV6PuO1FT
|
||||
JWp86a+AYHg7+sUWcoJRZPCTbb/pOcCa0q1ch5qcLkiYEOGK+pYhbPptq6y8IsJW
|
||||
N6EDNCVvVqVyTJy14FZWoOqxcpUiDOQ+su28j8++V+PMo+FO3SQqwEZwJXk7LF/4
|
||||
wUipDCUh/WNjDqqgmYLoO+ttiiJPbEw3jtbO+zopbzYpyEC1f06Nz7uz1daOIN3J
|
||||
etFPzSqWCE7Eq+hoVmAAm8gVmQir3rFJbIGBAvAaOLQEOkUlOlS7AezqUhdyhGER
|
||||
Zrvc3eNqxY7G61SEHipEJ7/hpcDq0RRWCXHsoQqyHaPje826n2pGkJYt4QARAQAB
|
||||
tBZMYXVuY2hwYWQgUFBBIGZvciBHTlMziQJOBBMBCgA4FiEEuDqqv/vYLSG1Q8jq
|
||||
hsIsLsaiTX8FAmY0jSYCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQhsIs
|
||||
LsaiTX9z9xAAq1uHmRgfYmELS0cr2YEnTWHPVE6s95Qx+0cr5zzNeWfmoAS9uSyl
|
||||
z8bCm+Q2ZapzU/nOtkozU+RGjgcRRTKMVTyS0PjFX22965xHCRWnw79fPyrYouUw
|
||||
H2cAT8WSGYEeVAbqhJSns0RnDpXuaxmWE1wT+iitY/QAjeXo22Z2mjv2bFTitKbY
|
||||
hZbE5Eu8Olc5YHCVI0ofq84/Ii921iMibU6EDMmm/iOnMK2uHGbC59t0YG8Rm7mK
|
||||
uk6+TpxOULjFeCWSkF2Dr33m8JQmtYZuFUnmqWPuSdBo3J0O1b0qTg+EP9FbDAtj
|
||||
CoEKT/V1ccMBd3r77o23CGsvpV7bzEU60A+NsU8vb/AkOmouYiF+qaYDFGZDfWhK
|
||||
p1HFmd1kt7YdgxsmoKoFJkbt1bBdcFJLV0Jcad5sfArg2aFDYf2giMxAw4iQ+9jc
|
||||
MCuwWxiqWicPqJ5erNTzVfayBkjuZqBDVTO9wmG3DL4QmNosIBS7kq+NGrT8Ql22
|
||||
FqYfdIZJDlKVtJKHK8eKJSB0dbFawV2h5p/CvQlIm6nthg5FzOyjvCkPkvxvveq+
|
||||
SuNxFEscumFCgo7j7RMWHW9HWK3TUvMmYLMVjxL8kXyCwknp9GklBQHA/IPxRa/2
|
||||
eFqqkmVbmNAoMzzw5wqa/BPcFEbgn+E+TFyZqbzp0F4QzPJZFkz16SA=
|
||||
=xnj5
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
EOFLIST
|
||||
else
|
||||
cat <<EOFLIST > /etc/apt/sources.list.d/gns3.list
|
||||
deb http://ppa.launchpad.net/gns3/ppa/ubuntu $UBUNTU_CODENAME main
|
||||
deb-src http://ppa.launchpad.net/gns3/ppa/ubuntu $UBUNTU_CODENAME main
|
||||
EOFLIST
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
if [ $I386_REPO == 1 ]
|
||||
then
|
||||
cat <<EOFLIST2 >> /etc/apt/sources.list
|
||||
###### Ubuntu Main Repos
|
||||
deb http://archive.ubuntu.com/ubuntu/ $UBUNTU_CODENAME main universe multiverse
|
||||
deb-src http://archive.ubuntu.com/ubuntu/ $UBUNTU_CODENAME main universe multiverse
|
||||
log "Updating system packages and installing curl"
|
||||
apt update
|
||||
apt install -y curl
|
||||
|
||||
###### Ubuntu Update Repos
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-security main universe multiverse
|
||||
deb http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-updates main universe multiverse
|
||||
deb-src http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-security main universe multiverse
|
||||
deb-src http://archive.ubuntu.com/ubuntu/ ${UBUNTU_CODENAME}-updates main universe multiverse
|
||||
EOFLIST2
|
||||
fi
|
||||
log "Upgrading packages"
|
||||
apt upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
|
||||
|
||||
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A2E3EF7B
|
||||
log "Installing the GNS3 server and its dependencies"
|
||||
apt install -y gns3-server
|
||||
|
||||
log "Update system packages"
|
||||
apt-get update
|
||||
|
||||
log "Upgrade packages"
|
||||
apt-get upgrade --yes --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
|
||||
|
||||
log "Install GNS3 packages"
|
||||
apt-get install -y gns3-server
|
||||
|
||||
log "Create user GNS3 with /opt/gns3 as home directory"
|
||||
log "Creating user GNS3 with /opt/gns3 as home directory"
|
||||
if [ ! -d "/opt/gns3" ]
|
||||
then
|
||||
useradd -m -d /opt/gns3 gns3
|
||||
fi
|
||||
|
||||
|
||||
log "Add GNS3 to the ubridge group"
|
||||
log "Adding GNS3 to the ubridge group"
|
||||
usermod -aG ubridge gns3
|
||||
|
||||
log "Install docker"
|
||||
log "Installing Docker"
|
||||
if [ ! -f "/usr/bin/docker" ]
|
||||
then
|
||||
curl -sSL https://get.docker.com | bash
|
||||
fi
|
||||
|
||||
log "Add GNS3 to the docker group"
|
||||
log "Adding GNS3 to the docker group"
|
||||
usermod -aG docker gns3
|
||||
|
||||
if [ $USE_IOU == 1 ]
|
||||
then
|
||||
log "Setup IOU"
|
||||
dpkg --add-architecture i386
|
||||
apt-get update
|
||||
log "Setting up IOU support"
|
||||
if [ $I386_REPO == 1 ]
|
||||
then
|
||||
log "Enabling i386 architecture for IOU support"
|
||||
dpkg --add-architecture i386
|
||||
apt update
|
||||
fi
|
||||
|
||||
apt-get install -y gns3-iou
|
||||
apt install -y gns3-iou
|
||||
|
||||
# Force the host name to gns3vm
|
||||
echo gns3vm > /etc/hostname
|
||||
@@ -196,31 +205,18 @@ then
|
||||
|
||||
# Force hostid for IOU
|
||||
dd if=/dev/zero bs=4 count=1 of=/etc/hostid
|
||||
|
||||
# Block potential IOU phone home call (xml.cisco.com is not in use at this time)
|
||||
log "Block IOU phone home call"
|
||||
if [ "$UBUNTU_CODENAME" == "focal" ]
|
||||
then
|
||||
iptables -I OUTPUT -p udp --dport 53 -m string --hex-string "|03|xml|05|cisco|03|com" --algo bm -j DROP
|
||||
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | debconf-set-selections
|
||||
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | debconf-set-selections
|
||||
apt-get install -y iptables-persistent
|
||||
else
|
||||
echo "127.0.0.254 xml.cisco.com" | tee --append /etc/hosts
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
log "Add gns3 to the kvm group"
|
||||
log "Adding gns3 to the kvm group"
|
||||
usermod -aG kvm gns3
|
||||
|
||||
log "Setup GNS3 server"
|
||||
log "Setting up the GNS3 server configuration"
|
||||
|
||||
mkdir -p /etc/gns3
|
||||
cat <<EOFC > /etc/gns3/gns3_server.conf
|
||||
[Server]
|
||||
host = 0.0.0.0
|
||||
port = 3080
|
||||
port = 3080
|
||||
images_path = /opt/gns3/images
|
||||
projects_path = /opt/gns3/projects
|
||||
appliances_path = /opt/gns3/appliances
|
||||
@@ -234,52 +230,15 @@ EOFC
|
||||
|
||||
if [ $DISABLE_KVM == 1 ]
|
||||
then
|
||||
log "Disable KVM support"
|
||||
log "Disabling KVM support"
|
||||
sed -i 's/hardware_acceleration = True/hardware_acceleration = False/g' /etc/gns3/gns3_server.conf
|
||||
fi
|
||||
|
||||
chown -R gns3:gns3 /etc/gns3
|
||||
chmod -R 700 /etc/gns3
|
||||
|
||||
if [ "$UBUNTU_CODENAME" == "trusty" ]
|
||||
then
|
||||
cat <<EOFI > /etc/init/gns3.conf
|
||||
description "GNS3 server"
|
||||
author "GNS3 Team"
|
||||
|
||||
start on filesystem or runlevel [2345]
|
||||
stop on runlevel [016]
|
||||
respawn
|
||||
console log
|
||||
|
||||
|
||||
script
|
||||
exec start-stop-daemon --start --make-pidfile --pidfile /var/run/gns3.pid --chuid gns3 --exec "/usr/bin/gns3server"
|
||||
end script
|
||||
|
||||
pre-start script
|
||||
echo "" > /var/log/upstart/gns3.log
|
||||
echo "[`date`] GNS3 Starting"
|
||||
end script
|
||||
|
||||
pre-stop script
|
||||
echo "[`date`] GNS3 Stopping"
|
||||
end script
|
||||
EOFI
|
||||
|
||||
chown root:root /etc/init/gns3.conf
|
||||
chmod 644 /etc/init/gns3.conf
|
||||
|
||||
|
||||
log "Start GNS3 service"
|
||||
set +e
|
||||
service gns3 stop
|
||||
set -e
|
||||
service gns3 start
|
||||
|
||||
else
|
||||
# Install systemd service
|
||||
cat <<EOFI > /lib/systemd/system/gns3.service
|
||||
log "Installing the GNS3 systemd service"
|
||||
cat <<EOFI > /lib/systemd/system/gns3.service
|
||||
[Unit]
|
||||
Description=GNS3 server
|
||||
After=network-online.target
|
||||
@@ -302,15 +261,15 @@ LimitNOFILE=16384
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOFI
|
||||
chmod 755 /lib/systemd/system/gns3.service
|
||||
chown root:root /lib/systemd/system/gns3.service
|
||||
|
||||
log "Start GNS3 service"
|
||||
systemctl enable gns3
|
||||
systemctl start gns3
|
||||
fi
|
||||
chmod 755 /lib/systemd/system/gns3.service
|
||||
chown root:root /lib/systemd/system/gns3.service
|
||||
|
||||
log "GNS3 installed with success"
|
||||
log "Starting the GNS3 service"
|
||||
systemctl enable gns3
|
||||
systemctl start gns3
|
||||
|
||||
log "GNS3 has been installed with success"
|
||||
|
||||
if [ $WELCOME_SETUP == 1 ]
|
||||
then
|
||||
@@ -319,11 +278,9 @@ gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-key
|
||||
gns3 ALL = (ALL) NOPASSWD: /usr/bin/apt-get
|
||||
gns3 ALL = (ALL) NOPASSWD: /usr/sbin/reboot
|
||||
EOFI
|
||||
NEEDRESTART_MODE=a apt-get install -y net-tools
|
||||
NEEDRESTART_MODE=a apt-get install -y python3-pip
|
||||
NEEDRESTART_MODE=a apt-get install -y dialog
|
||||
pip install --no-input --upgrade pip
|
||||
pip install --no-input pythondialog
|
||||
NEEDRESTART_MODE=a apt install -y net-tools
|
||||
NEEDRESTART_MODE=a apt install -y dialog
|
||||
NEEDRESTART_MODE=a apt install -y python3-dialog
|
||||
|
||||
#Pull down welcome script from repo
|
||||
curl https://raw.githubusercontent.com/GNS3/gns3-server/master/scripts/welcome.py > /usr/local/bin/welcome.py
|
||||
@@ -350,19 +307,15 @@ fi
|
||||
|
||||
if [ $USE_VPN == 1 ]
|
||||
then
|
||||
log "Setup VPN"
|
||||
log "Setting up OpenVPN"
|
||||
|
||||
log "Change GNS3 to listen on VPN interface"
|
||||
log "Changing the GNS3 server configuration to listen on VPN interface"
|
||||
|
||||
sed -i 's/host = 0.0.0.0/host = 172.16.253.1/' /etc/gns3/gns3_server.conf
|
||||
|
||||
log "Install packages for OpenVPN"
|
||||
log "Installing the OpenVPN packages"
|
||||
|
||||
apt-get install -y \
|
||||
openvpn \
|
||||
uuid \
|
||||
dnsutils \
|
||||
nginx-light
|
||||
apt install -y openvpn uuid dnsutils nginx-light
|
||||
|
||||
MY_IP_ADDR=$(dig @ns1.google.com -t txt o-o.myaddr.l.google.com +short -4 | sed 's/"//g')
|
||||
|
||||
@@ -370,7 +323,7 @@ log "IP detected: $MY_IP_ADDR"
|
||||
|
||||
UUID=$(uuid)
|
||||
|
||||
log "Update motd"
|
||||
log "Updating motd"
|
||||
|
||||
cat <<EOFMOTD > /etc/update-motd.d/70-openvpn
|
||||
#!/bin/sh
|
||||
@@ -381,7 +334,7 @@ echo "http://$MY_IP_ADDR:8003/$UUID/$HOSTNAME.ovpn"
|
||||
echo ""
|
||||
echo "And add it to your openvpn client."
|
||||
echo ""
|
||||
echo "apt-get remove nginx-light to disable the HTTP server."
|
||||
echo "apt remove nginx-light to disable the HTTP server."
|
||||
echo "And remove this file with rm /etc/update-motd.d/70-openvpn"
|
||||
EOFMOTD
|
||||
chmod 755 /etc/update-motd.d/70-openvpn
|
||||
@@ -391,7 +344,7 @@ mkdir -p /etc/openvpn/
|
||||
[ -d /dev/net ] || mkdir -p /dev/net
|
||||
[ -c /dev/net/tun ] || mknod /dev/net/tun c 10 200
|
||||
|
||||
log "Create keys"
|
||||
log "Creating OpenVPN keys"
|
||||
|
||||
[ -f /etc/openvpn/dh.pem ] || openssl dhparam -out /etc/openvpn/dh.pem 2048
|
||||
[ -f /etc/openvpn/key.pem ] || openssl genrsa -out /etc/openvpn/key.pem 2048
|
||||
@@ -399,7 +352,7 @@ chmod 600 /etc/openvpn/key.pem
|
||||
[ -f /etc/openvpn/csr.pem ] || openssl req -new -key /etc/openvpn/key.pem -out /etc/openvpn/csr.pem -subj /CN=OpenVPN/
|
||||
[ -f /etc/openvpn/cert.pem ] || openssl x509 -req -in /etc/openvpn/csr.pem -out /etc/openvpn/cert.pem -signkey /etc/openvpn/key.pem -days 24855
|
||||
|
||||
log "Create client configuration"
|
||||
log "Creating OpenVPN client configuration"
|
||||
cat <<EOFCLIENT > /root/client.ovpn
|
||||
client
|
||||
nobind
|
||||
@@ -441,7 +394,7 @@ status openvpn-status-1194.log
|
||||
log-append /var/log/openvpn-udp1194.log
|
||||
EOFUDP
|
||||
|
||||
log "Setup HTTP server for serving client certificate"
|
||||
log "Setting up an HTTP server for serving client certificate"
|
||||
mkdir -p /usr/share/nginx/openvpn/$UUID
|
||||
cp /root/client.ovpn /usr/share/nginx/openvpn/$UUID/$HOSTNAME.ovpn
|
||||
touch /usr/share/nginx/openvpn/$UUID/index.html
|
||||
@@ -458,7 +411,7 @@ EOFNGINX
|
||||
service nginx stop
|
||||
service nginx start
|
||||
|
||||
log "Restart OpenVPN and GNS3"
|
||||
log "Restarting OpenVPN and GNS3"
|
||||
|
||||
set +e
|
||||
service openvpn stop
|
||||
@@ -466,15 +419,15 @@ service openvpn start
|
||||
service gns3 stop
|
||||
service gns3 start
|
||||
|
||||
log "Download http://$MY_IP_ADDR:8003/$UUID/$HOSTNAME.ovpn to setup your OpenVPN client after rebooting the server"
|
||||
log "Please download http://$MY_IP_ADDR:8003/$UUID/$HOSTNAME.ovpn to setup your OpenVPN client after rebooting the server"
|
||||
|
||||
fi
|
||||
|
||||
if [ $WELCOME_SETUP == 1 ]
|
||||
then
|
||||
NEEDRESTART_MODE=a apt-get update
|
||||
NEEDRESTART_MODE=a apt-get upgrade
|
||||
python3 -c 'import sys; sys.path.append("/usr/local/bin/"); import welcome; ws = welcome.Welcome_dialog(); ws.repair_remote_install()'
|
||||
cd /opt/gns3
|
||||
su gns3
|
||||
NEEDRESTART_MODE=a apt update
|
||||
NEEDRESTART_MODE=a apt upgrade
|
||||
python3 -c 'import sys; sys.path.append("/usr/local/bin/"); import welcome; ws = welcome.Welcome_dialog(); ws.repair_remote_install()'
|
||||
cd /opt/gns3
|
||||
su gns3
|
||||
fi
|
||||
@@ -146,7 +146,7 @@ def fake_image(tmpdir) -> str:
|
||||
|
||||
path = str(tmpdir / "7200.bin")
|
||||
with open(path, "wb+") as f:
|
||||
f.write(b'\x7fELF\x01\x01\x01')
|
||||
f.write(b'\x7fELF\x01\x02\x01')
|
||||
os.chmod(path, stat.S_IREAD)
|
||||
return path
|
||||
|
||||
@@ -170,7 +170,7 @@ async def test_images(app: FastAPI, compute_client: AsyncClient, tmpdir, fake_im
|
||||
assert response.json() == [{"filename": "7200.bin",
|
||||
"path": "7200.bin",
|
||||
"filesize": 7,
|
||||
"md5sum": "e573e8f5c93c6c00783f20c7a170aa6c"}]
|
||||
"md5sum": "b0d5aa897d937aced5a6b1046e8f7e2e"}]
|
||||
|
||||
|
||||
async def test_upload_image(app: FastAPI, compute_client: AsyncClient, images_dir: str) -> None:
|
||||
|
||||
@@ -48,7 +48,7 @@ def fake_qemu_vm(images_dir) -> str:
|
||||
img_dir = os.path.join(images_dir, "QEMU")
|
||||
bin_path = os.path.join(img_dir, "linux载.img")
|
||||
with open(bin_path, "w+") as f:
|
||||
f.write("1")
|
||||
f.write("1234567")
|
||||
os.chmod(bin_path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
return bin_path
|
||||
|
||||
@@ -127,7 +127,7 @@ async def test_qemu_create_with_params(app: FastAPI,
|
||||
assert response.json()["project_id"] == compute_project.id
|
||||
assert response.json()["ram"] == 1024
|
||||
assert response.json()["hda_disk_image"] == "linux载.img"
|
||||
assert response.json()["hda_disk_image_md5sum"] == "c4ca4238a0b923820dcc509a6f75849b"
|
||||
assert response.json()["hda_disk_image_md5sum"] == "fcea920f7412b5da7be0cf42b8c93759"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@@ -387,7 +387,8 @@ async def test_images(app: FastAPI, compute_client: AsyncClient, fake_qemu_vm) -
|
||||
|
||||
response = await compute_client.get(app.url_path_for("compute:get_qemu_images"))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert {"filename": "linux载.img", "path": "linux载.img", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1} in response.json()
|
||||
print(response.json())
|
||||
assert {"filename": "linux载.img", "path": "linux载.img", "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7} in response.json()
|
||||
|
||||
|
||||
async def test_upload_image(app: FastAPI, compute_client: AsyncClient, tmpdir: str) -> None:
|
||||
|
||||
@@ -28,14 +28,16 @@ pytestmark = pytest.mark.asyncio
|
||||
|
||||
class TestApplianceRoutes:
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _install_builtin_appliances(self, controller: Controller):
|
||||
# @pytest.fixture(autouse=True)
|
||||
# def _install_builtin_appliances(self, controller: Controller):
|
||||
#
|
||||
# controller.appliance_manager.install_builtin_appliances()
|
||||
# controller.appliance_manager.load_appliances()
|
||||
|
||||
controller.appliance_manager.install_builtin_appliances()
|
||||
async def test_appliances_list(self, app: FastAPI, client: AsyncClient, controller: Controller) -> None:
|
||||
|
||||
await controller.appliance_manager.install_builtin_appliances()
|
||||
controller.appliance_manager.load_appliances()
|
||||
|
||||
async def test_appliances_list(self, app: FastAPI, client: AsyncClient) -> None:
|
||||
|
||||
response = await client.get(app.url_path_for("get_appliances"))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert len(response.json()) > 0
|
||||
|
||||
@@ -19,6 +19,7 @@ import os
|
||||
import pytest
|
||||
import hashlib
|
||||
|
||||
from tests.utils import asyncio_patch
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
@@ -261,10 +262,13 @@ class TestImageRoutes:
|
||||
|
||||
async def test_prune_images(self, app: FastAPI, client: AsyncClient, db_session: AsyncSession) -> None:
|
||||
|
||||
response = await client.post(app.url_path_for("prune_images"))
|
||||
images_repo = ImagesRepository(db_session)
|
||||
images_in_db = await images_repo.get_images()
|
||||
assert len(images_in_db) != 0
|
||||
|
||||
response = await client.delete(app.url_path_for("prune_images"))
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
||||
images_repo = ImagesRepository(db_session)
|
||||
images_in_db = await images_repo.get_images()
|
||||
assert len(images_in_db) == 0
|
||||
|
||||
@@ -275,7 +279,7 @@ class TestImageRoutes:
|
||||
controller: Controller
|
||||
) -> None:
|
||||
|
||||
controller.appliance_manager.install_builtin_appliances()
|
||||
await controller.appliance_manager.install_builtin_appliances()
|
||||
controller.appliance_manager.load_appliances() # make sure appliances are loaded
|
||||
image_path = "tests/resources/empty30G.qcow2"
|
||||
image_name = os.path.basename(image_path)
|
||||
@@ -292,3 +296,32 @@ class TestImageRoutes:
|
||||
assert len(templates) == 1
|
||||
assert templates[0].name == "Empty VM"
|
||||
assert templates[0].version == "30G"
|
||||
await templates_repo.delete_template(templates[0].template_id)
|
||||
|
||||
async def test_install_all(
|
||||
self, app: FastAPI,
|
||||
client: AsyncClient,
|
||||
db_session: AsyncSession,
|
||||
controller: Controller
|
||||
) -> None:
|
||||
|
||||
image_path = "tests/resources/empty100G.qcow2"
|
||||
image_name = os.path.basename(image_path)
|
||||
with open(image_path, "rb") as f:
|
||||
image_data = f.read()
|
||||
response = await client.post(
|
||||
app.url_path_for("upload_image", image_path=image_name),
|
||||
content=image_data)
|
||||
assert response.status_code == status.HTTP_201_CREATED
|
||||
|
||||
controller.appliance_manager.load_appliances() # make sure appliances are loaded
|
||||
with asyncio_patch("gns3server.api.routes.controller.images.get_builtin_disks", return_value=[]) as mock:
|
||||
response = await client.post(app.url_path_for("install_images"))
|
||||
assert mock.called
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
||||
templates_repo = TemplatesRepository(db_session)
|
||||
templates = await templates_repo.get_templates()
|
||||
assert len(templates) == 1
|
||||
assert templates[0].name == "Empty VM"
|
||||
assert templates[0].version == "100G"
|
||||
@@ -16,6 +16,8 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
import uuid
|
||||
import unittest.mock
|
||||
@@ -145,29 +147,39 @@ class TestTemplateRoutes:
|
||||
tmpdir: str,
|
||||
) -> None:
|
||||
|
||||
path = os.path.join(tmpdir, "test.qcow2")
|
||||
with open(path, "wb+") as f:
|
||||
image1 = os.path.join(tmpdir, "image1.qcow2")
|
||||
with open(image1, "wb+") as f:
|
||||
f.write(b'\x42\x42\x42\x42')
|
||||
|
||||
image2 = os.path.join(tmpdir, "image2.qcow2")
|
||||
with open(image2, "wb+") as f:
|
||||
f.write(b'\x42\x42\x42\x42')
|
||||
|
||||
images_repo = ImagesRepository(db_session)
|
||||
await images_repo.add_image("test.qcow2", "qemu", 42, path, "e342eb86c1229b6c154367a5476969b5", "md5")
|
||||
await images_repo.add_image("image1.qcow2", "qemu", 42, image1, "e342eb86c1229b6c154367a5476969b5", "md5")
|
||||
await images_repo.add_image("image2.qcow2", "qemu", 42, image2, "e342eb86c1229b6c154367a5476969b5", "md5")
|
||||
|
||||
template_id = str(uuid.uuid4())
|
||||
params = {"template_id": template_id,
|
||||
"name": "QEMU_TEMPLATE",
|
||||
"compute_id": "local",
|
||||
"hda_disk_image": "test.qcow2",
|
||||
"hda_disk_image": "image1.qcow2",
|
||||
"hdb_disk_image": "image2.qcow2",
|
||||
"template_type": "qemu"}
|
||||
|
||||
response = await client.post(app.url_path_for("create_template"), json=params)
|
||||
assert response.status_code == status.HTTP_201_CREATED
|
||||
|
||||
templates_repo = TemplatesRepository(db_session)
|
||||
images = await templates_repo.get_template_images(response.json().get("template_id"))
|
||||
assert len(images) == 2
|
||||
|
||||
response = await client.delete(
|
||||
app.url_path_for("delete_template", template_id=template_id),
|
||||
params={"prune_images": True}
|
||||
)
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
||||
images_repo = ImagesRepository(db_session)
|
||||
images = await images_repo.get_images()
|
||||
assert len(images) == 0
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@ from typing import Optional
|
||||
from fastapi import FastAPI, HTTPException, status
|
||||
from sqlalchemy import update
|
||||
from httpx import AsyncClient
|
||||
from jose import jwt
|
||||
from joserfc import jwt
|
||||
from joserfc.jwk import OctKey
|
||||
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
@@ -166,16 +167,23 @@ class TestAuthTokens:
|
||||
|
||||
jwt_secret = config.settings.Controller.jwt_secret_key
|
||||
token = auth_service.create_access_token(test_user.username)
|
||||
payload = jwt.decode(token, jwt_secret, algorithms=["HS256"])
|
||||
username = payload.get("sub")
|
||||
key = OctKey.import_key(jwt_secret)
|
||||
payload = jwt.decode(token, key, algorithms=["HS256"])
|
||||
username = payload.claims.get("sub")
|
||||
assert username == test_user.username
|
||||
|
||||
async def test_token_missing_user_is_invalid(self, app: FastAPI, client: AsyncClient, config: Config) -> None:
|
||||
async def test_decode_token_with_wrong_algorithm(
|
||||
self,
|
||||
app: FastAPI,
|
||||
client: AsyncClient,
|
||||
test_user: User,
|
||||
config: Config
|
||||
) -> None:
|
||||
|
||||
jwt_secret = config.settings.Controller.jwt_secret_key
|
||||
token = auth_service.create_access_token(None)
|
||||
with pytest.raises(jwt.JWTError):
|
||||
jwt.decode(token, jwt_secret, algorithms=["HS256"])
|
||||
token = auth_service.create_access_token(test_user.username)
|
||||
with pytest.raises(ValueError):
|
||||
jwt.decode(token, jwt_secret, algorithms=["ES256"])
|
||||
|
||||
async def test_can_retrieve_username_from_token(
|
||||
self,
|
||||
@@ -236,9 +244,10 @@ class TestUserLogin:
|
||||
|
||||
# check that token exists in response and has user encoded within it
|
||||
token = response.json().get("access_token")
|
||||
payload = jwt.decode(token, jwt_secret, algorithms=["HS256"])
|
||||
assert "sub" in payload
|
||||
username = payload.get("sub")
|
||||
key = OctKey.import_key(jwt_secret)
|
||||
payload = jwt.decode(token, key, algorithms=["HS256"])
|
||||
assert "sub" in payload.claims
|
||||
username = payload.claims.get("sub")
|
||||
assert username == test_user.username
|
||||
|
||||
# check that token is proper type
|
||||
|
||||
@@ -31,6 +31,9 @@ ALLOWED_CONTROLLER_ENDPOINTS = [
|
||||
("/", "GET"),
|
||||
("/debug", "GET"),
|
||||
("/static/web-ui/{file_path:path}", "GET"),
|
||||
("/docs", "GET"),
|
||||
("/docs/oauth2-redirect", "GET"),
|
||||
("/redoc", "GET"),
|
||||
("/v3/version", "GET"),
|
||||
("/v3/version", "POST"),
|
||||
("/v3/access/users/login", "POST"),
|
||||
|
||||
@@ -92,7 +92,7 @@ async def test_start(vm):
|
||||
|
||||
mock_process = MagicMock()
|
||||
vm._check_requirements = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_licence = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_license = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ubridge = AsyncioMagicMock(return_value=True)
|
||||
vm._ubridge_send = AsyncioMagicMock()
|
||||
|
||||
@@ -104,7 +104,7 @@ async def test_start(vm):
|
||||
assert vm.command_line == ' '.join(mock_exec.call_args[0])
|
||||
|
||||
assert vm._check_requirements.called
|
||||
assert vm._check_iou_licence.called
|
||||
assert vm._check_iou_license.called
|
||||
assert vm._start_ubridge.called
|
||||
vm._ubridge_send.assert_any_call("iol_bridge delete IOL-BRIDGE-513")
|
||||
vm._ubridge_send.assert_any_call("iol_bridge create IOL-BRIDGE-513 513")
|
||||
@@ -120,7 +120,8 @@ async def test_start_with_iourc(vm, tmpdir, config):
|
||||
mock_process = MagicMock()
|
||||
|
||||
vm._check_requirements = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_licence = AsyncioMagicMock(return_value=True)
|
||||
vm._is_iou_license_check_enabled = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_license = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ioucon = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ubridge = AsyncioMagicMock(return_value=True)
|
||||
vm._ubridge_send = AsyncioMagicMock()
|
||||
@@ -157,7 +158,7 @@ async def test_stop(vm):
|
||||
|
||||
process = MagicMock()
|
||||
vm._check_requirements = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_licence = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_license = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ioucon = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ubridge = AsyncioMagicMock(return_value=True)
|
||||
vm._ubridge_send = AsyncioMagicMock()
|
||||
@@ -183,7 +184,7 @@ async def test_reload(vm, fake_iou_bin):
|
||||
|
||||
process = MagicMock()
|
||||
vm._check_requirements = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_licence = AsyncioMagicMock(return_value=True)
|
||||
vm._check_iou_license = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ioucon = AsyncioMagicMock(return_value=True)
|
||||
vm._start_ubridge = AsyncioMagicMock(return_value=True)
|
||||
vm._ubridge_send = AsyncioMagicMock()
|
||||
@@ -383,42 +384,42 @@ def test_get_legacy_vm_workdir():
|
||||
async def test_invalid_iou_file(vm, iourc_file):
|
||||
|
||||
hostname = socket.gethostname()
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Missing ;
|
||||
with pytest.raises(IOUError):
|
||||
with open(iourc_file, "w+") as f:
|
||||
f.write("[license]\n{} = aaaaaaaaaaaaaaaa".format(hostname))
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Key too short
|
||||
with pytest.raises(IOUError):
|
||||
with open(iourc_file, "w+") as f:
|
||||
f.write("[license]\n{} = aaaaaaaaaaaaaa;".format(hostname))
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Invalid hostname
|
||||
with pytest.raises(IOUError):
|
||||
with open(iourc_file, "w+") as f:
|
||||
f.write("[license]\nbla = aaaaaaaaaaaaaa;")
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Missing licence section
|
||||
with pytest.raises(IOUError):
|
||||
with open(iourc_file, "w+") as f:
|
||||
f.write("[licensetest]\n{} = aaaaaaaaaaaaaaaa;")
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Broken config file
|
||||
with pytest.raises(IOUError):
|
||||
with open(iourc_file, "w+") as f:
|
||||
f.write("[")
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
# Missing file
|
||||
with pytest.raises(IOUError):
|
||||
os.remove(iourc_file)
|
||||
await vm._check_iou_licence()
|
||||
await vm._check_iou_license()
|
||||
|
||||
|
||||
def test_iourc_content(vm):
|
||||
|
||||
@@ -217,12 +217,12 @@ async def test_list_images(qemu, tmpdir):
|
||||
os.makedirs(tmp_images_dir, exist_ok=True)
|
||||
for image in fake_images:
|
||||
with open(os.path.join(tmp_images_dir, image), "w+") as f:
|
||||
f.write("1")
|
||||
f.write("1234567")
|
||||
|
||||
with patch("gns3server.utils.images.default_images_directory", return_value=str(tmp_images_dir)):
|
||||
assert sorted(await qemu.list_images(), key=lambda k: k['filename']) == [
|
||||
{"filename": "a.qcow2", "path": "a.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1},
|
||||
{"filename": "b.qcow2", "path": "b.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}
|
||||
{"filename": "a.qcow2", "path": "a.qcow2", "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7},
|
||||
{"filename": "b.qcow2", "path": "b.qcow2", "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7}
|
||||
]
|
||||
|
||||
|
||||
@@ -234,19 +234,19 @@ async def test_list_images_recursives(qemu, tmpdir):
|
||||
fake_images = ["a.qcow2", "b.qcow2", ".blu.qcow2", "a.qcow2.md5sum"]
|
||||
for image in fake_images:
|
||||
with open(os.path.join(tmp_images_dir, image), "w+") as f:
|
||||
f.write("1")
|
||||
f.write("1234567")
|
||||
os.makedirs(os.path.join(tmp_images_dir, "c"))
|
||||
fake_images = ["c.qcow2", "c.qcow2.md5sum"]
|
||||
for image in fake_images:
|
||||
with open(os.path.join(tmp_images_dir, "c", image), "w+") as f:
|
||||
f.write("1")
|
||||
f.write("1234567")
|
||||
|
||||
with patch("gns3server.utils.images.default_images_directory", return_value=str(tmp_images_dir)):
|
||||
|
||||
assert sorted(await qemu.list_images(), key=lambda k: k['filename']) == [
|
||||
{"filename": "a.qcow2", "path": "a.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1},
|
||||
{"filename": "b.qcow2", "path": "b.qcow2", "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1},
|
||||
{"filename": "c.qcow2", "path": force_unix_path(os.path.sep.join(["c", "c.qcow2"])), "md5sum": "c4ca4238a0b923820dcc509a6f75849b", "filesize": 1}
|
||||
{"filename": "a.qcow2", "path": "a.qcow2", "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7},
|
||||
{"filename": "b.qcow2", "path": "b.qcow2", "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7},
|
||||
{"filename": "c.qcow2", "path": force_unix_path(os.path.sep.join(["c", "c.qcow2"])), "md5sum": "fcea920f7412b5da7be0cf42b8c93759", "filesize": 7}
|
||||
]
|
||||
|
||||
|
||||
|
||||
+3
-1
@@ -400,10 +400,12 @@ def run_around_tests(monkeypatch, config, port_manager):
|
||||
config.settings.VMware.vmrun_path = tmppath
|
||||
config.settings.Dynamips.dynamips_path = tmppath
|
||||
|
||||
|
||||
# Force turn off KVM because it's not available on CI
|
||||
config.settings.Qemu.enable_hardware_acceleration = False
|
||||
|
||||
# avoid monitoring for new images while testing
|
||||
config.settings.Server.auto_discover_images = False
|
||||
|
||||
monkeypatch.setattr("gns3server.utils.path.get_default_project_directory", lambda *args: os.path.join(tmppath, 'projects'))
|
||||
|
||||
# Force sys.platform to the original value. Because it seems not be restored correctly after each test
|
||||
|
||||
@@ -87,7 +87,7 @@ async def test_compute_httpQuery(compute):
|
||||
response.status = 200
|
||||
await compute.post("/projects", {"a": "b"})
|
||||
await compute.close()
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=120)
|
||||
assert compute._auth is None
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ async def test_compute_httpQueryAuth(compute):
|
||||
compute.password = SecretStr("toor")
|
||||
await compute.post("/projects", {"a": "b"})
|
||||
await compute.close()
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=compute._auth, chunked=None, timeout=20)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=b'{"a": "b"}', headers={'content-type': 'application/json'}, auth=compute._auth, chunked=None, timeout=120)
|
||||
assert compute._auth.login == "root"
|
||||
assert compute._auth.password == "toor"
|
||||
|
||||
@@ -162,7 +162,7 @@ async def test_compute_httpQueryNotConnectedInvalidVersion(compute):
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
with pytest.raises(ControllerError):
|
||||
await compute.post("/projects", {"a": "b"})
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=120)
|
||||
await compute.close()
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ async def test_compute_httpQueryNotConnectedNonGNS3Server(compute):
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
with pytest.raises(ControllerError):
|
||||
await compute.post("/projects", {"a": "b"})
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=120)
|
||||
await compute.close()
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ async def test_compute_httpQueryNotConnectedNonGNS3Server2(compute):
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
with pytest.raises(ControllerError):
|
||||
await compute.post("/projects", {"a": "b"})
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/capabilities", headers={'content-type': 'application/json'}, data=None, auth=None, chunked=None, timeout=120)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@@ -228,7 +228,7 @@ async def test_compute_httpQuery_project(compute):
|
||||
project = Project(name="Test")
|
||||
mock_notification.assert_called()
|
||||
await compute.post("/projects", project)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=json.dumps(project.asdict()), headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=20)
|
||||
mock.assert_called_with("POST", "https://example.com:84/v3/compute/projects", data=json.dumps(project.asdict()), headers={'content-type': 'application/json'}, auth=None, chunked=None, timeout=120)
|
||||
await compute.close()
|
||||
|
||||
# FIXME: https://github.com/aio-libs/aiohttp/issues/2525
|
||||
@@ -430,7 +430,7 @@ async def test_interfaces(compute):
|
||||
response.status = 200
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
assert await compute.interfaces() == res
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/network/interfaces", auth=None, chunked=None, data=None, headers={'content-type': 'application/json'}, timeout=20)
|
||||
mock.assert_any_call("GET", "https://example.com:84/v3/compute/network/interfaces", auth=None, chunked=None, data=None, headers={'content-type': 'application/json'}, timeout=120)
|
||||
await compute.close()
|
||||
|
||||
|
||||
|
||||
@@ -245,7 +245,8 @@ async def test_start(controller):
|
||||
}
|
||||
|
||||
#with asyncio_patch("gns3server.controller.compute.Compute.connect") as mock:
|
||||
await controller.start()
|
||||
with asyncio_patch("gns3server.controller.Controller._install_builtin_disks", return_value=[]):
|
||||
await controller.start()
|
||||
#assert mock.called
|
||||
assert len(controller.computes) == 1 # Local compute is created
|
||||
assert controller.computes["local"].name == f"{socket.gethostname()} (controller)"
|
||||
@@ -266,8 +267,9 @@ async def test_start_vm(controller):
|
||||
with asyncio_patch("gns3server.controller.gns3vm.vmware_gns3_vm.VMwareGNS3VM.start") as mock:
|
||||
with asyncio_patch("gns3server.controller.gns3vm.GNS3VM._check_network"):
|
||||
with asyncio_patch("gns3server.controller.compute.Compute.connect"):
|
||||
await controller.start()
|
||||
assert mock.called
|
||||
with asyncio_patch("gns3server.controller.Controller._install_builtin_disks", return_value=[]):
|
||||
await controller.start()
|
||||
assert mock.called
|
||||
assert "local" in controller.computes
|
||||
assert "vm" in controller.computes
|
||||
assert len(controller.computes) == 2 # Local compute and vm are created
|
||||
@@ -356,7 +358,7 @@ async def test_install_base_configs(controller, config, tmpdir):
|
||||
with open(str(tmpdir / 'iou_l2_base_startup-config.txt'), 'w+') as f:
|
||||
f.write('test')
|
||||
|
||||
controller._install_base_configs()
|
||||
await controller._install_base_configs()
|
||||
assert os.path.exists(str(tmpdir / 'iou_l3_base_startup-config.txt'))
|
||||
|
||||
# Check is the file has not been overwritten
|
||||
@@ -385,12 +387,13 @@ async def test_install_base_configs(controller, config, tmpdir):
|
||||
async def test_install_builtin_disks(controller, config, tmpdir, builtin_disk):
|
||||
|
||||
config.settings.Server.images_path = str(tmpdir)
|
||||
controller._install_builtin_disks()
|
||||
await controller._install_builtin_disks()
|
||||
# we only install Qemu empty disks at this time
|
||||
assert os.path.exists(str(tmpdir / "QEMU" / builtin_disk))
|
||||
|
||||
|
||||
def test_appliances(controller, config, tmpdir):
|
||||
@pytest.mark.asyncio
|
||||
async def test_appliances(controller, config, tmpdir):
|
||||
|
||||
my_appliance = {
|
||||
"name": "My Appliance",
|
||||
@@ -406,7 +409,7 @@ def test_appliances(controller, config, tmpdir):
|
||||
json.dump(my_appliance, f)
|
||||
|
||||
config.settings.Server.appliances_path = str(tmpdir)
|
||||
controller.appliance_manager.install_builtin_appliances()
|
||||
await controller.appliance_manager.install_builtin_appliances()
|
||||
controller.appliance_manager.load_appliances()
|
||||
assert len(controller.appliance_manager.appliances) > 0
|
||||
for appliance in controller.appliance_manager.appliances.values():
|
||||
|
||||
Binary file not shown.
+57
-32
@@ -114,64 +114,89 @@ def test_remove_checksum(tmpdir):
|
||||
@pytest.mark.asyncio
|
||||
async def test_list_images(tmpdir, config):
|
||||
|
||||
path1 = tmpdir / "images1" / "IOS" / "test1.image"
|
||||
path1.write(b'\x7fELF\x01\x01\x01', ensure=True)
|
||||
path1 = force_unix_path(str(path1))
|
||||
# IOS image in the images directory
|
||||
ios_image_1 = tmpdir / "images1" / "IOS" / "ios_image_1.image"
|
||||
ios_image_1.write(b'\x7fELF\x01\x02\x01', ensure=True)
|
||||
ios_image_1 = force_unix_path(str(ios_image_1))
|
||||
|
||||
path2 = tmpdir / "images2" / "test2.image"
|
||||
path2.write(b'\x7fELF\x01\x01\x01', ensure=True)
|
||||
path2 = force_unix_path(str(path2))
|
||||
# IOS image in an additional images path
|
||||
ios_image_2 = tmpdir / "images2" / "ios_image_2.image"
|
||||
ios_image_2.write(b'\x7fELF\x01\x02\x01', ensure=True)
|
||||
ios_image_2 = force_unix_path(str(ios_image_2))
|
||||
|
||||
# Invalid image because not a valid elf file
|
||||
path = tmpdir / "images2" / "test_invalid.image"
|
||||
path.write(b'NOTANELF', ensure=True)
|
||||
# Not a valid elf file
|
||||
not_elf_file = tmpdir / "images1" / "IOS" / "not_elf.image"
|
||||
not_elf_file.write(b'NOTANELF', ensure=True)
|
||||
not_elf_file = force_unix_path(str(not_elf_file))
|
||||
|
||||
# Invalid image because it is very small
|
||||
small_file = tmpdir / "images1" / "too_small.image"
|
||||
small_file.write(b'1', ensure=True)
|
||||
|
||||
if sys.platform.startswith("linux"):
|
||||
path3 = tmpdir / "images1" / "IOU" / "test3.bin"
|
||||
path3.write(b'\x7fELF\x02\x01\x01', ensure=True)
|
||||
path3 = force_unix_path(str(path3))
|
||||
# 64-bit IOU image
|
||||
iou_image_1 = tmpdir / "images1" / "IOU" / "iou64.bin"
|
||||
iou_image_1.write(b'\x7fELF\x02\x01\x01', ensure=True)
|
||||
iou_image_1 = force_unix_path(str(iou_image_1))
|
||||
# 32-bit IOU image
|
||||
iou_image_2 = tmpdir / "images1" / "IOU" / "iou32.bin"
|
||||
iou_image_2.write(b'\x7fELF\x01\x01\x01', ensure=True) # 32-bit IOU image
|
||||
iou_image_2 = force_unix_path(str(iou_image_2))
|
||||
|
||||
path4 = tmpdir / "images1" / "QEMU" / "test4.qcow2"
|
||||
path4.write("1", ensure=True)
|
||||
path4 = force_unix_path(str(path4))
|
||||
|
||||
path5 = tmpdir / "images1" / "QEMU" / "test4.qcow2.md5sum"
|
||||
path5.write("1", ensure=True)
|
||||
path5 = force_unix_path(str(path5))
|
||||
# Qemu image
|
||||
qemu_image_1 = tmpdir / "images1" / "QEMU" / "qemu_image.qcow2"
|
||||
qemu_image_1.write("1234567", ensure=True)
|
||||
qemu_image_1 = force_unix_path(str(qemu_image_1))
|
||||
|
||||
# ELF file inside the Qemu
|
||||
elf_file = tmpdir / "images1" / "QEMU" / "elf_file.bin"
|
||||
elf_file.write(b'\x7fELF\x02\x01\x01', ensure=True) # ELF file
|
||||
elf_file = force_unix_path(str(elf_file))
|
||||
|
||||
md5sum_file = tmpdir / "images1" / "QEMU" / "image.qcow2.md5sum"
|
||||
md5sum_file.write("1", ensure=True)
|
||||
md5sum_file = force_unix_path(str(md5sum_file))
|
||||
|
||||
config.settings.Server.images_path = str(tmpdir / "images1")
|
||||
config.settings.Server.additional_images_paths = "/tmp/null24564;" + str(tmpdir / "images2")
|
||||
|
||||
assert await list_images("dynamips") == [
|
||||
assert sorted(await list_images("dynamips"), key=lambda k: k['filename']) == [
|
||||
{
|
||||
'filename': 'test1.image',
|
||||
'filename': 'ios_image_1.image',
|
||||
'filesize': 7,
|
||||
'md5sum': 'e573e8f5c93c6c00783f20c7a170aa6c',
|
||||
'path': 'test1.image'
|
||||
'md5sum': 'b0d5aa897d937aced5a6b1046e8f7e2e',
|
||||
'path': 'ios_image_1.image'
|
||||
},
|
||||
{
|
||||
'filename': 'test2.image',
|
||||
'filename': 'ios_image_2.image',
|
||||
'filesize': 7,
|
||||
'md5sum': 'e573e8f5c93c6c00783f20c7a170aa6c',
|
||||
'path': str(path2)
|
||||
'md5sum': 'b0d5aa897d937aced5a6b1046e8f7e2e',
|
||||
'path': str(ios_image_2)
|
||||
}
|
||||
]
|
||||
|
||||
if sys.platform.startswith("linux"):
|
||||
assert await list_images("iou") == [
|
||||
assert sorted(await list_images("iou"), key=lambda k: k['filename']) == [
|
||||
{
|
||||
'filename': 'test3.bin',
|
||||
'filename': 'iou32.bin',
|
||||
'filesize': 7,
|
||||
'md5sum': 'e573e8f5c93c6c00783f20c7a170aa6c',
|
||||
'path': 'iou32.bin'
|
||||
},
|
||||
{
|
||||
'filename': 'iou64.bin',
|
||||
'filesize': 7,
|
||||
'md5sum': 'c73626d23469519894d58bc98bee9655',
|
||||
'path': 'test3.bin'
|
||||
'path': 'iou64.bin'
|
||||
}
|
||||
]
|
||||
|
||||
assert await list_images("qemu") == [
|
||||
{
|
||||
'filename': 'test4.qcow2',
|
||||
'filesize': 1,
|
||||
'md5sum': 'c4ca4238a0b923820dcc509a6f75849b',
|
||||
'path': 'test4.qcow2'
|
||||
'filename': 'qemu_image.qcow2',
|
||||
'filesize': 7,
|
||||
'md5sum': 'fcea920f7412b5da7be0cf42b8c93759',
|
||||
'path': 'qemu_image.qcow2'
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user