1 # Copyright 2022 highstreet technologies GmbH
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
18 Module as entry point to generatate a TAPI topology json
21 from controller.parameter_validator import ParameterValidator
22 from controller.network_generator import TopologyGenerator
23 from view.network_viewer import NetworkViewer
25 validator: ParameterValidator = ParameterValidator(sys.argv)
27 if validator.is_valid():
28 configuration = validator.configuration()
29 generator = TopologyGenerator(configuration)
30 network = generator.generate()
31 viewer = NetworkViewer(network)
33 filename: str = "output/network.json"
34 if configuration['network']['name']:
35 filename = "output/" + configuration['network']['name'] + ".json"
36 viewer.json().save(filename)
37 # viewer.json().showAsJson()
39 filename: str = "output/network.svg"
40 if configuration['network']['name']:
41 filename = "output/" + configuration['network']['name'] + ".svg"
45 print(validator.error_message())