Example #1
0
        """get the reference segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the reference segment type.
        """
        return cs.RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE

    def get_parsed_data(self):
        """get dictionary of parsed segment data.
        """
        # dw_data = self.get_data()
        # self._parsed_data['Segment Type'] = "{0} ({1})".format("Reference Segment",
        #                                                  str(hex(int('{:0b}'.format(dw_data[0]).zfill(32)[16:32], 2))))
        # offset = cs.SEGMENTS_HEADER_SIZE_IN_DW
        #
        # if len(dw_data) > cs.SEGMENTS_HEADER_SIZE_IN_DW:
        #     self._parsed_data['reference_segment'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[16:32], 2)))
        #     offset += 1
        #     self._parsed_data['index1'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[0:32], 2)))
        #     offset += 1
        #     self._parsed_data['index2'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[0:32], 2)))
        #     offset += 1
        #     self._parsed_data['num_of_obj1'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[0:16], 2)))
        #     self._parsed_data['num_of_obj2'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[16:32], 2)))
        return self._parsed_data


SegmentFactory.register(cs.RESOURCE_DUMP_SEGMENT_TYPE_REFERENCE, RefSegment)
Example #2
0
# Created on:      14-Aug-2019 10:11:57 AM
# Original author: talve
#
#######################################################
from segments.Segment import Segment
from segments.SegmentFactory import SegmentFactory
from utils import constants


class ErrorSegment(Segment):
    """this class is responsible for holding error segment data.
    """
    def __init__(self, data):
        """initialize the class by setting the class data.
        """
        self.raw_data = data

    def get_data(self):
        """get the general segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return constants.RESOURCE_DUMP_SEGMENT_TYPE_ERROR


SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_ERROR,
                        ErrorSegment)
Example #3
0
# Created on:      14-Aug-2019 10:11:57 AM
# Original author: talve
#
#######################################################
from segments.Segment import Segment
from segments.SegmentFactory import SegmentFactory
from utils import constants


class TerminateSegment(Segment):
    """this class is responsible for holding Terminate segment data.
    """
    def __init__(self, data):
        """initialize the class by setting the class data.
        """
        self.raw_data = data

    def get_data(self):
        """get the general segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return constants.RESOURCE_DUMP_SEGMENT_TYPE_TERMINATE


SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_TERMINATE,
                        TerminateSegment)
Example #4
0
# Created on:      14-Aug-2019 10:11:57 AM
# Original author: talve
#
#######################################################
from segments.Segment import Segment
from segments.SegmentFactory import SegmentFactory
from utils import constants


class CommandSegment(Segment):
    """this class is responsible for holding command segment data.
    """
    def __init__(self, data):
        """initialize the class by setting the class data.
        """
        self.raw_data = data

    def get_data(self):
        """get the general segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return constants.RESOURCE_DUMP_SEGMENT_TYPE_COMMAND


SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_COMMAND,
                        CommandSegment)
Example #5
0
# Generated by Enterprise Architect
# Created on:      14-Aug-2019 10:11:57 AM
# Original author: talve
#
#######################################################
from segments.Segment import Segment
from segments.SegmentFactory import SegmentFactory
from utils import constants


class InfoSegment(Segment):
    """this class is responsible for holding info segment data.
    """
    def __init__(self, data):
        """initialize the class by setting the class data.
        """
        self.raw_data = data

    def get_data(self):
        """get the general segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return constants.RESOURCE_DUMP_SEGMENT_TYPE_INFO


SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_INFO, InfoSegment)
Example #6
0
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return cs.RESOURCE_DUMP_SEGMENT_TYPE_NOTICE

    def get_parsed_data(self):
        """get dictionary of parsed segment data.
        """
        dw_data = self.get_data()
        # self._parsed_data['Segment Type'] = "{0} ({1})".format("Notice Segment", str(
        #     hex(int('{:0b}'.format(dw_data[0]).zfill(32)[16:32], 2))))

        offset = cs.SEGMENTS_HEADER_SIZE_IN_DW
        if len(dw_data) > cs.SEGMENTS_HEADER_SIZE_IN_DW:
            # self._parsed_data['syndrome_id'] = str(hex(int('{:0b}'.format(dw_data[offset]).zfill(32)[16:32], 2)))
            try:
                self._parsed_data['notice msg'] = MenuRecord.bin_list_to_ascii(
                    dw_data[cs.ERROR_SEGMENT_NOTICE_MSG_START:cs.
                            ERROR_SEGMENT_NOTICE_MSG_END])
            except:
                # in case that the bin is not an ascii we will not display the notice msg
                pass

        return self._parsed_data


SegmentFactory.register(cs.RESOURCE_DUMP_SEGMENT_TYPE_NOTICE, NoticeSegment)
Example #7
0
                    .format(dump_type))

            if num_of_objs_1 == "all" and not match_rec.supports_all_num_of_obj1:
                raise DumpNotSupported(
                    "Dump type: {0} does not support 'all' as numOfObj1 attribute"
                    .format(dump_type))

            if num_of_objs_2 == "all" and not match_rec.supports_all_num_of_obj2:
                raise DumpNotSupported(
                    "Dump type: {0} does not support 'all' as numOfObj2 attribute"
                    .format(dump_type))

            if num_of_objs_1 == "active" and not match_rec.supports_active_num_of_obj1:
                raise DumpNotSupported(
                    "Dump type: {0} does not support 'active' as numOfObj1 attribute"
                    .format(dump_type))

            if num_of_objs_2 == "active" and not match_rec.supports_active_num_of_obj2:
                raise DumpNotSupported(
                    "Dump type: {0} does not support 'active' as numOfObj2 attribute"
                    .format(dump_type))

        except DumpNotSupported as e:
            print(e)
            return False

        return True


SegmentFactory.register(cs.RESOURCE_DUMP_SEGMENT_TYPE_MENU, MenuSegment)
# Original author: talve
#
#######################################################
from segments.Segment import Segment
from segments.SegmentFactory import SegmentFactory
from utils import constants


class ResourceSegment(Segment):
    """this class is responsible for holding Resource segment data.
    """
    def __init__(self, data):
        """initialize the class by setting the class data.
        """
        self.raw_data = data
        self.resource_type = constants.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE

    def get_data(self):
        """get the general segment data.
        """
        return self.raw_data

    def get_type(self):
        """get the general segment type.
        """
        return self.resource_type


SegmentFactory.register(constants.RESOURCE_DUMP_SEGMENT_TYPE_RESOURCE,
                        ResourceSegment)