mirror of
https://github.com/GNS3/gns3-registry.git
synced 2024-12-18 20:37:57 +00:00
Repository => Registry
This commit is contained in:
parent
493bfe3d19
commit
3175e72da9
10
README.rst
10
README.rst
@ -1,8 +1,8 @@
|
||||
GNS3-repository
|
||||
GNS3-registry
|
||||
================
|
||||
|
||||
|
||||
This is the GNS3 devices repository.
|
||||
This is the GNS3 devices registry.
|
||||
|
||||
You need python 3.4
|
||||
|
||||
@ -11,14 +11,14 @@ Add an image
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python3.4 gns3repository/main.py --add ~/Downloads/linux-microcore-3.4.1.img
|
||||
python3.4 gns3registry/main.py --add ~/Downloads/linux-microcore-3.4.1.img
|
||||
|
||||
Search an image
|
||||
****************
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python3.4 gns3repository/main.py --search core
|
||||
python3.4 gns3registry/main.py --search core
|
||||
|
||||
Micro Core Linux:
|
||||
* 3.4.1 linux-microcore-3.4.1.img: 5f42d71b30bc682e44ccf7340e20ea7ea8967ef5
|
||||
@ -32,6 +32,6 @@ If the image is available from the internet you can download and install it:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
python3.4 gns3repository/main.py --install 0252f2c913519c993b812325bbd553af2d77218a
|
||||
python3.4 gns3registry/main.py --install 0252f2c913519c993b812325bbd553af2d77218a
|
||||
|
||||
Download http://downloads.sourceforge.net/project/gns-3/Qemu%20Appliances/linux-microcore-4.0.2-clean.img to /Users/noplay/GNS3/images/linux-microcore-4.0.2-clean.img
|
||||
|
@ -20,7 +20,7 @@
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
from gns3repository.image import Image
|
||||
from gns3registry.image import Image
|
||||
|
||||
|
||||
class Config:
|
@ -23,10 +23,10 @@ from distutils.util import strtobool
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
from gns3repository.repository import Repository
|
||||
from gns3repository.config import Config
|
||||
from gns3registry.registry import Repository
|
||||
from gns3registry.config import Config
|
||||
|
||||
repository = Repository()
|
||||
registry = Repository()
|
||||
config = Config()
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ def yes_no(message):
|
||||
pass
|
||||
|
||||
def add_image(image):
|
||||
confs = repository.detect_image(image)
|
||||
confs = registry.detect_image(image)
|
||||
if len(confs) > 0:
|
||||
print("Found: {} devices configuration".format(len(confs)))
|
||||
for conf in confs:
|
||||
@ -48,7 +48,7 @@ def add_image(image):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Manage GNS3 repository")
|
||||
parser = argparse.ArgumentParser(description="Manage GNS3 registry")
|
||||
parser.add_argument("--add", dest="add_image", action="store",
|
||||
help="Add an image to GNS3")
|
||||
parser.add_argument("--search", dest="search", action="store",
|
||||
@ -66,12 +66,12 @@ if __name__ == "__main__":
|
||||
if args.add_image:
|
||||
add_image(args.add_image)
|
||||
elif args.search:
|
||||
for res in repository.search_device(args.search):
|
||||
for res in registry.search_device(args.search):
|
||||
print("{}: ".format(res["name"]))
|
||||
for file in res["hda_disk_image"]:
|
||||
print(" * {} {}: {}".format(file["version"], file["filename"], file["sha1sum"]))
|
||||
elif args.install:
|
||||
image = repository.download_image(args.install, config.images_dir)
|
||||
image = registry.download_image(args.install, config.images_dir)
|
||||
add_image(image)
|
||||
else:
|
||||
parser.print_help()
|
@ -23,9 +23,9 @@ import os
|
||||
import re
|
||||
import urllib.request
|
||||
|
||||
from gns3repository.image import Image
|
||||
from gns3registry.image import Image
|
||||
|
||||
class Repository:
|
||||
class Registry:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@ -90,7 +90,7 @@ class Repository:
|
||||
|
||||
def _get_devices_path(self):
|
||||
"""
|
||||
Get the path where the repository files are located
|
||||
Get the path where the registry files are located
|
||||
"""
|
||||
path = os.path.abspath(os.path.dirname(__file__))
|
||||
return os.path.join(path, "..", "devices")
|
@ -20,8 +20,8 @@
|
||||
import pytest
|
||||
import json
|
||||
|
||||
from gns3repository.config import Config
|
||||
from gns3repository.image import Image
|
||||
from gns3registry.config import Config
|
||||
from gns3registry.image import Image
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -20,7 +20,7 @@
|
||||
import pytest
|
||||
import json
|
||||
|
||||
from gns3repository.repository import Repository
|
||||
from gns3registry.registry import Registry
|
||||
|
||||
|
||||
def test_detect_image(linux_microcore_img):
|
||||
@ -28,18 +28,18 @@ def test_detect_image(linux_microcore_img):
|
||||
with open("devices/qemu/microcore-linux.json") as f:
|
||||
config = json.load(f)
|
||||
|
||||
repository = Repository()
|
||||
detected = repository.detect_image(linux_microcore_img)
|
||||
registry = Registry()
|
||||
detected = registry.detect_image(linux_microcore_img)
|
||||
assert detected[0]["name"] == "Micro Core Linux"
|
||||
assert detected[0]["hda_disk_image"].version == "3.4.1"
|
||||
|
||||
|
||||
def test_detect_unknow_image(empty_file):
|
||||
repository = Repository()
|
||||
assert repository.detect_image(empty_file) == []
|
||||
registry = Registry()
|
||||
assert registry.detect_image(empty_file) == []
|
||||
|
||||
|
||||
def test_search_device():
|
||||
repository = Repository()
|
||||
results = repository.search_device("Micro Core Linux")
|
||||
registry = Registry()
|
||||
results = registry.search_device("Micro Core Linux")
|
||||
assert len(results) == 1
|
||||
|
Loading…
Reference in New Issue
Block a user