Commit 1879c55a authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Common - Tools - Type Checkers:

- Polished assertions for link attributes
parent 6d2fa750
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
# Copyright 2022-2025 ETSI SDG TeraFlowSDN (TFS) (https://tfs.etsi.org/)
#
# 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.
+3 −1
Original line number Diff line number Diff line
@@ -511,7 +511,9 @@ def validate_component(component):

def validate_link_attributes(link_attributes):
    assert isinstance(link_attributes, dict)
    assert len(link_attributes.keys()) == 2
    assert len(link_attributes.keys()) == 3
    assert 'is_bidirectional' in link_attributes
    assert isinstance(link_attributes['is_bidirectional'], bool)
    assert 'total_capacity_gbps' in link_attributes
    assert isinstance(link_attributes['total_capacity_gbps'], (int, float))
    assert 'used_capacity_gbps' in link_attributes