コード例 #1
0
    def debug_receive_c_store_rsp(msg):
        """Debugging function when a C-STORE-RSP is received.

        Parameters
        ----------
        msg : pynetdicom3.DIMSEmessage.C_STORE_RSP
            The received C-STORE-RSP message.

        TODO: Add in the extra status related elements if present
        """
        cs = msg.command_set

        dataset = 'None'
        if msg.data_set.getvalue() != b'':
            dataset = 'Present'

        # See PS3.4 Annex B.2.3 for Storage Service Class Statuses
        # Try and get the status from the affected SOP class UID
        sop_class = uid_to_sop_class(cs.AffectedSOPClassUID)
        if cs.Status in sop_class.statuses:
            status = sop_class.statuses[cs.Status]
            status_str = '0x{0:04x} - {1}'.format(cs.Status, status[0])
        else:
            status_str = '0x{0:04x} - Unknown'

        LOGGER.info('Received Store Response')
        s = []
        s.append(
            '===================== INCOMING DIMSE MESSAGE ================'
            '====')
        s.append('Message Type                  : {0!s}'.format('C-STORE RSP'))
        s.append('Presentation Context ID       : {0!s}'.format(msg.ID))
        s.append('Message ID Being Responded To : {0!s}'.format(
            cs.MessageIDBeingRespondedTo))
        s.append('Affected SOP Class UID        : {0!s}'.format(
            cs.AffectedSOPClassUID))
        s.append('Affected SOP Instance UID     : {0!s}'.format(
            cs.AffectedSOPInstanceUID))
        s.append('Data Set                      : {0!s}'.format(dataset))
        s.append('DIMSE Status                  : {0!s}'.format(status_str))

        s.append(
            '======================= END DIMSE MESSAGE ==================='
            '====')

        for line in s:
            LOGGER.debug(line)
コード例 #2
0
 def test_missing_sop(self):
     """Test raise if SOP Class not found."""
     with pytest.raises(NotImplementedError):
         uid_to_sop_class('1.2.3.4')
コード例 #3
0
ファイル: test_sop.py プロジェクト: tony32769/pynetdicom3
 def test_verification_uid(self):
     """Test normal function"""
     assert uid_to_sop_class('1.2.840.10008.1.1') == VerificationSOPClass
コード例 #4
0
 def test_existing(self):
     """Test that the existing class is returned."""
     original = VerificationSOPClass
     sop_class = uid_to_sop_class('1.2.840.10008.1.1')
     assert id(sop_class) == id(original)
コード例 #5
0
 def test_missing_sop(self):
     """Test SOP Class if UID not found."""
     sop_class = uid_to_sop_class('1.2.3.4')
     assert sop_class == '1.2.3.4'
     assert sop_class.service_class == ServiceClass