Esempio n. 1
0
    def populate_member_values(self, iot_objects_array):
        '''
        Get all the information from the 'iot_objects_array' in one traversal of the array.
        Then we populate the members of the SecurityReport object with the appropriate values.

        Params:
        iot_objects_array The IoT Objects array from which we are going to create the SecurityReport.
        '''

        self.total_objects_count = len(iot_objects_array)

        # Define the counters.
        # Object type : Others or B2C
        others_counter = 0
        eiot_counter = 0
        b2c_counter = 0
        # Risks
        high_risks_counter = 0
        moderate_risks_counter = 0
        light_risks_counter = 0
        accepted_risks_counter = 0
        solved_risks_counter = 0

        # Security Progress
        not_started_counter = 0
        in_progress_counter = 0
        on_hold_counter = 0
        done_counter = 0
        not_evaluated_counter = 0

        # Delivery Security Phase
        in_evaluation_counter = 0
        in_qualification_counter = 0
        in_audit_counter = 0
        in_testing_counter = 0
        on_the_market_counter = 0

        for iot_object in iot_objects_array:
            # Object type : Others or B2C
            if iot_object.is_eiot:
                eiot_counter = eiot_counter + 1
            elif iot_object.is_b2b:
                others_counter = others_counter + 1
            elif iot_object.is_b2c:
                b2c_counter = b2c_counter + 1

            # Risks
            high_risks_counter = high_risks_counter + iot_object.high_risks_counter
            moderate_risks_counter = moderate_risks_counter + iot_object.moderate_risks_counter
            light_risks_counter = light_risks_counter + iot_object.light_risks_counter
            accepted_risks_counter = accepted_risks_counter + iot_object.accepted_risks_counter
            solved_risks_counter = solved_risks_counter + iot_object.solved_risks_counter

            # Security Progress
            import variables
            if iot_object.security_phase_progress == variables.DONE_PHASE:
                done_counter = done_counter + 1
            elif iot_object.security_phase_progress == variables.IN_PROGRESS_PHASE:
                in_progress_counter = in_progress_counter + 1
            elif iot_object.security_phase_progress == variables.ON_HOLD_PHASE:
                on_hold_counter = on_hold_counter + 1
            elif iot_object.security_phase_progress == variables.NOT_EVALUATED_PHASE:
                not_evaluated_counter = not_evaluated_counter + 1
            elif iot_object.security_phase_progress == variables.NOT_STARTED_PHASE:
                not_started_counter = not_started_counter + 1

            # Delivery Security Phase
            if iot_object.delivery_security_process_phase == variables.EVALUATION_PHASE:
                in_evaluation_counter = in_evaluation_counter + 1
            elif iot_object.delivery_security_process_phase == variables.QUALIFICATION_PHASE:
                in_qualification_counter = in_qualification_counter + 1
            elif iot_object.delivery_security_process_phase == variables.SECURITY_AUDIT_PHASE:
                in_audit_counter = in_audit_counter + 1
            elif iot_object.delivery_security_process_phase == variables.TESTING_PHASE:
                in_testing_counter = in_testing_counter + 1
            elif iot_object.delivery_security_process_phase == variables.IN_LIFE_PHASE:
                on_the_market_counter = on_the_market_counter + 1

        # Object type : Others, EIOT or B2C
        self.others_objects_count = others_counter
        self.eiot_objects_count = eiot_counter
        self.b2c_objects_count = b2c_counter

        # Risks : High, Moderate or Light risks
        self.risks.high_risks = high_risks_counter
        self.risks.moderate_risks = moderate_risks_counter
        self.risks.light_risks = light_risks_counter
        self.risks.accepted_risks = accepted_risks_counter
        self.risks.solved_risks = solved_risks_counter
        self.risks.riskiestobjects_list = self.__get_riskiestobjects_list(
            iot_objects_array)

        #SecurityPhaseProgress : Not Started, In Progress, On Hold, Done, Not Evaluated
        self.security_phase_progress.not_started_objects = not_started_counter
        self.security_phase_progress.in_progress_objects = in_progress_counter
        self.security_phase_progress.on_hold_objects = on_hold_counter
        self.security_phase_progress.done_objects = done_counter
        self.security_phase_progress.not_evaluated_objects = not_evaluated_counter

        #DeliverySecurityPhase : Evaluation, Qualification, Testing, Audit, In Life
        self.delivery_security_process.evaluation_objects = in_evaluation_counter
        self.delivery_security_process.qualification_objects = in_qualification_counter
        self.delivery_security_process.testing_objects = in_testing_counter
        self.delivery_security_process.security_audit_objects = in_audit_counter
        self.delivery_security_process.in_life_objects = on_the_market_counter

        #Highlights
        from report_creation_utils import xml_utils
        import variables
        highlights_file_path = os.path.join(
            variables.SECURITY_PROJECTS_DIRPATH, variables.HISTORY_FOLDER_NAME,
            variables.HIGHLIGHTS_FILE_NAME)
        monthly_highlights = xml_utils.get_element_value(
            highlights_file_path, 'MonthlyHighlights')
        highlighted_risks = xml_utils.get_element_value(
            highlights_file_path, 'HighlightedRisks')
        problems_identified = xml_utils.get_element_value(
            highlights_file_path, 'ProblemsIdentified')
        self.highlights.monthly_highlights = monthly_highlights
        self.highlights.highlighted_risks = highlighted_risks
        self.highlights.problems_identified = problems_identified
Esempio n. 2
0
def get_go_no_go_result(xml_file):
    '''Return the data in the 'goNoGo' item in the xml file'''

    return xml_utils.get_element_value(xml_file, 'goNoGo')
Esempio n. 3
0
def get_result(xml_file):
    '''Return the data in the 'result' item in the xml file'''

    return xml_utils.get_element_value(xml_file, 'result')
Esempio n. 4
0
def get_comment(xml_file):
    '''Return the data in the 'Comments' item in the xml file'''

    return xml_utils.get_element_value(xml_file, 'Comments')
Esempio n. 5
0
def get_person_in_charge(xml_file):
    '''Return the data in the 'personInCharge' item in the xml file'''

    return xml_utils.get_element_value(xml_file, 'personInCharge')