Coverage for d7a/alp/operands/indirect_interface_operand.py: 94%
16 statements
« prev ^ index » next coverage.py v7.5.0, created at 2024-05-24 08:03 +0200
« prev ^ index » next coverage.py v7.5.0, created at 2024-05-24 08:03 +0200
1#
2# Copyright (c) 2015-2021 University of Antwerp, Aloxy NV.
3#
4# This file is part of pyd7a.
5# See https://github.com/Sub-IoT/pyd7a for further info.
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19from d7a.alp.interface import InterfaceType
20from d7a.d7anp.addressee import Addressee
21from d7a.sp.configuration import Configuration
22from d7a.support.schema import Validatable, Types
25class IndirectInterfaceOperand(Validatable):
27 SCHEMA = [{
28 "interface_file_id" : Types.INTEGER(min=0, max=0xFF),
29 "interface_configuration_overload" : Types.OBJECT(Addressee, nullable=True) # TODO assuming D7ASP interface
30 }]
32 def __init__(self, interface_file_id, interface_configuration_overload=None):
33 self.interface_file_id = interface_file_id
34 self.interface_configuration_overload = interface_configuration_overload
35 super(IndirectInterfaceOperand, self).__init__()
37 def __iter__(self):
38 yield self.interface_file_id
39 if self.interface_configuration_overload is not None:
40 for byte in self.interface_configuration_overload: yield byte
42 def __str__(self):
43 return "interface-file-id={}, configuration-overload={}".format(self.interface_file_id, self.interface_configuration_overload)