X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=code%2Fnetwork-generator%2Ftests%2Ftest_o_ran_network.py;fp=code%2Fnetwork-generator%2Ftests%2Ftest_o_ran_network.py;h=06b32cdb407cefb00be19ec632729e59d49a5597;hb=762eebc5c889ff1aa37a8db5d028088c15b10cf6;hp=0000000000000000000000000000000000000000;hpb=3bcc2ea0b963df3dfb17b6d634abdc0144a80c33;p=oam.git diff --git a/code/network-generator/tests/test_o_ran_network.py b/code/network-generator/tests/test_o_ran_network.py new file mode 100644 index 0000000..06b32cd --- /dev/null +++ b/code/network-generator/tests/test_o_ran_network.py @@ -0,0 +1,41 @@ +# Copyright 2023 highstreet technologies GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from typing import Any +from network_generation.base import NetworkGenerator +from network_generation.parameter_validator import ParameterValidator +from network_generation.model.python.o_ran_network import ORanNetwork + + +def test_o_ran_network(get_path_name) -> None: + config_file: str = get_path_name + "/test_config.json" + + validator: ParameterValidator = ParameterValidator( + ["command", config_file] + ) + + if validator.is_valid(): + configuration: dict = validator.configuration() + generator: NetworkGenerator = NetworkGenerator( + configuration["network"] + ) + o_ran_network: ORanNetwork = generator.generate() + + assert len(o_ran_network.id) == 36 + assert o_ran_network.administrativeState.value == "locked" + topology: dict[str, Any] = o_ran_network.to_topology() + assert len(topology["ietf-network:networks"]["network"]) == 1 + + # ["network-id"] == ( + # o_ran_network.id)