1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-28 11:18:11 +00:00

You can validate a topology from command line

This commit is contained in:
Julien Duponchelle 2016-08-22 10:31:57 +02:00
parent fe9e824f1c
commit 324962def5
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -19,10 +19,10 @@
# This file contains the validation for checking a .gns3 file
#
from .compute import COMPUTE_OBJECT_SCHEMA
from .drawing import DRAWING_OBJECT_SCHEMA
from .link import LINK_OBJECT_SCHEMA
from .node import NODE_OBJECT_SCHEMA
from gns3server.schemas.compute import COMPUTE_OBJECT_SCHEMA
from gns3server.schemas.drawing import DRAWING_OBJECT_SCHEMA
from gns3server.schemas.link import LINK_OBJECT_SCHEMA
from gns3server.schemas.node import NODE_OBJECT_SCHEMA
TOPOLOGY_SCHEMA = {
@ -99,3 +99,14 @@ TOPOLOGY_SCHEMA = {
],
"additionalProperties": False
}
def main():
import jsonschema
import sys
with open(sys.argv[1]) as f:
jsonschema.validate(f.read(), TOPOLOGY_SCHEMA)
if __name__ == '__main__':
main()