linting ...
[oam.git] / code / network-generator / tests / test_o_ran_network.py
1 # Copyright 2023 highstreet technologies GmbH
2 #
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
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
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.
14
15 from typing import Any
16 from network_generation.base import NetworkGenerator
17 from network_generation.parameter_validator import ParameterValidator
18 from network_generation.model.python.o_ran_network import ORanNetwork
19
20
21 def test_o_ran_network(get_path_name) -> None:
22     config_file: str = get_path_name + "/test_config.json"
23
24     validator: ParameterValidator = ParameterValidator(
25         ["command", config_file]
26     )
27
28     if validator.is_valid():
29         configuration: dict = validator.configuration()
30         generator: NetworkGenerator = NetworkGenerator(
31             configuration["network"]
32         )
33         o_ran_network: ORanNetwork = generator.generate()
34
35         assert len(o_ran_network.id) == 36
36         assert o_ran_network.administrativeState.value == "locked"
37         topology: dict[str, Any] = o_ran_network.to_topology()
38         assert len(topology["ietf-network:networks"]["network"]) == 1
39
40         # ["network-id"] == (
41         #     o_ran_network.id)