def test_dib_device_informatio(self): """Test string representation of DIBDeviceInformation.""" dib = DIBDeviceInformation() dib.knx_medium = KNXMedium.TP1 dib.programming_mode = False dib.individual_address = PhysicalAddress("1.1.0") dib.name = "Gira KNX/IP-Router" dib.mac_address = "00:01:02:03:04:05" dib.multicast_address = "224.0.23.12" dib.serial_number = "13:37:13:37:13:37" dib.project_number = 564 dib.installation_number = 2 self.assertEqual( str(dib), "<DIBDeviceInformation \n" '\tknx_medium="KNXMedium.TP1" \n' '\tprogramming_mode="False" \n' '\tindividual_address="PhysicalAddress("1.1.0")" \n' '\tinstallation_number="2" \n' '\tproject_number="564" \n' '\tserial_number="13:37:13:37:13:37" \n' '\tmulticast_address="224.0.23.12" \n' '\tmac_address="00:01:02:03:04:05" \n' '\tname="Gira KNX/IP-Router" />', )
def fake_router_search_response(xknx: XKNX) -> KNXIPFrame: """Return the KNXIPFrame of a KNX/IP Router with a SearchResponse body.""" frame_body = SearchResponse(xknx) frame_body.control_endpoint = HPAI(ip_addr="192.168.42.10", port=3671) device_information = DIBDeviceInformation() device_information.name = "Gira KNX/IP-Router" device_information.serial_number = "11:22:33:44:55:66" device_information.individual_address = IndividualAddress("1.1.0") device_information.mac_address = "01:02:03:04:05:06" svc_families = DIBSuppSVCFamilies() svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.CORE, version=1)) svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.DEVICE_MANAGEMENT, version=2)) svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.TUNNELING, version=1)) svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.ROUTING, version=1)) svc_families.families.append( DIBSuppSVCFamilies.Family( name=DIBServiceFamily.REMOTE_CONFIGURATION_DIAGNOSIS, version=1)) frame_body.dibs.append(device_information) frame_body.dibs.append(svc_families) return KNXIPFrame.init_from_body(frame_body)
def fake_router_search_response(xknx: XKNX) -> SearchResponse: """Return the SearchResponse of a KNX/IP Router.""" _frame_header = KNXIPHeader(xknx) _frame_header.service_type_ident = KNXIPServiceType.SEARCH_RESPONSE _frame_body = SearchResponse(xknx) _frame_body.control_endpoint = HPAI(ip_addr="192.168.42.10", port=3671) _device_information = DIBDeviceInformation() _device_information.name = "Gira KNX/IP-Router" _device_information.serial_number = "11:22:33:44:55:66" _device_information.individual_address = PhysicalAddress("1.1.0") _device_information.mac_address = "01:02:03:04:05:06" _svc_families = DIBSuppSVCFamilies() _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.CORE, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.DEVICE_MANAGEMENT, version=2)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.TUNNELING, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.ROUTING, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.REMOTE_CONFIGURATION_DIAGNOSIS, version=1)) _frame_body.dibs.append(_device_information) _frame_body.dibs.append(_svc_families) _frame_header.set_length(_frame_body) search_response = KNXIPFrame(xknx) search_response.init(KNXIPServiceType.SEARCH_RESPONSE) search_response.header = _frame_header search_response.body = _frame_body search_response.normalize() return search_response
def fake_router_search_response(xknx: XKNX) -> SearchResponse: """Return the SearchResponse of a KNX/IP Router.""" _frame_header = KNXIPHeader(xknx) _frame_header.service_type_ident = KNXIPServiceType.SEARCH_RESPONSE _frame_body = SearchResponse(xknx) _frame_body.control_endpoint = HPAI(ip_addr="192.168.42.10", port=3671) _device_information = DIBDeviceInformation() _device_information.name = "Gira KNX/IP-Router" _device_information.serial_number = "11:22:33:44:55:66" _device_information.individual_address = PhysicalAddress("1.1.0") _device_information.mac_address = "01:02:03:04:05:06" _svc_families = DIBSuppSVCFamilies() _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.CORE, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.DEVICE_MANAGEMENT, version=2)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.TUNNELING, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family(name=DIBServiceFamily.ROUTING, version=1)) _svc_families.families.append( DIBSuppSVCFamilies.Family( name=DIBServiceFamily.REMOTE_CONFIGURATION_DIAGNOSIS, version=1)) _frame_body.dibs.append(_device_information) _frame_body.dibs.append(_svc_families) _frame_header.set_length(_frame_body) search_response = KNXIPFrame(xknx) search_response.init(KNXIPServiceType.SEARCH_RESPONSE) search_response.header = _frame_header search_response.body = _frame_body search_response.normalize() return search_response
def test_dib_device_informatio(self): """Test string representation of DIBDeviceInformation.""" dib = DIBDeviceInformation() dib.knx_medium = KNXMedium.TP1 dib.programming_mode = False dib.individual_address = PhysicalAddress('1.1.0') dib.name = 'Gira KNX/IP-Router' dib.mac_address = '00:01:02:03:04:05' dib.multicast_address = '224.0.23.12' dib.serial_number = '13:37:13:37:13:37' dib.project_number = 564 dib.installation_number = 2 self.assertEqual( str(dib), '<DIBDeviceInformation \n' '\tknx_medium="KNXMedium.TP1" \n' '\tprogramming_mode="False" \n' '\tindividual_address="PhysicalAddress("1.1.0")" \n' '\tinstallation_number="2" \n' '\tproject_number="564" \n' '\tserial_number="13:37:13:37:13:37" \n' '\tmulticast_address="224.0.23.12" \n' '\tmac_address="00:01:02:03:04:05" \n' '\tname="Gira KNX/IP-Router" />')