intracom-telecom-sdn/nstat

View on GitHub
stress_test/monitor.py

Summary

Maintainability
F
1 wk
Test Coverage

Showing 38 of 38 total issues

File monitor.py has 971 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2016 Intracom S.A. Telecom Solutions. All rights reserved.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
Severity: Major
Found in stress_test/monitor.py - About 2 days to fix

    Function monitor_thread_active has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def monitor_thread_active(self):
    """
    This monitor function is used from south bound active mtcbench \
    tests to put into gevent queue the results during test running
    """
    Severity: Minor
    Found in stress_test/monitor.py - About 2 hrs to fix

    Cyclomatic complexity is too high in method monitor_thread_active. (8)
    Open

    def monitor_thread_active(self):
    """
    This monitor function is used from south bound active mtcbench \
    tests to put into gevent queue the results during test running
    """
    Severity: Minor
    Found in stress_test/monitor.py by radon

    Function monitor_thread_idle has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def monitor_thread_idle(self, boot_start_time):
    """
    This monitor function is used from south bound idle mtcbench \
    tests to put into gevent queue the results during test running
     
    Severity: Minor
    Found in stress_test/monitor.py - About 2 hrs to fix

    Function monitor_thread_idle_scalability has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def monitor_thread_idle_scalability(self, boot_start_time):
    """
    This monitor function is used from both idle scalability multinet tests
    tests to put into gevent queue the results during test running
     
    Severity: Minor
    Found in stress_test/monitor.py - About 2 hrs to fix

    Cyclomatic complexity is too high in method monitor_thread_idle. (7)
    Open

    def monitor_thread_idle(self, boot_start_time):
    """
    This monitor function is used from south bound idle mtcbench \
    tests to put into gevent queue the results during test running
     
    Severity: Minor
    Found in stress_test/monitor.py by radon

    Cyclomatic complexity is too high in method monitor_thread_idle_scalability. (7)
    Open

    def monitor_thread_idle_scalability(self, boot_start_time):
    """
    This monitor function is used from both idle scalability multinet tests
    tests to put into gevent queue the results during test running
     
    Severity: Minor
    Found in stress_test/monitor.py by radon

    Cyclomatic complexity is too high in method monitor_run. (7)
    Open

    def monitor_run(self, reference_results=None, sample_id=None,
    boot_start_time=None):
    """
    This monitor function is used from both south bound active and idle \
    multinet tests to get the results from gevent queue
    Severity: Minor
    Found in stress_test/monitor.py by radon

    Function monitor_thread_active has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def monitor_thread_active(self):
    """
    This monitor function is used from active scalability multinet tests
    to put the results into gevent queue
    """
    Severity: Minor
    Found in stress_test/monitor.py - About 1 hr to fix

      Function monitor_thread_idle_stability has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def monitor_thread_idle_stability(self, reference_results, sample_id):
      """
      This monitor function is used from idle stability multinet tests \
      to put the results into gevent queue
       
      Severity: Minor
      Found in stress_test/monitor.py - About 1 hr to fix

        Function __poll_flows_ds_confirm has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def __poll_flows_ds_confirm(self, expected_flows):
        """
        Monitors operational DS until the expected number of flows are found
        or the deadline is reached.
         
        Severity: Minor
        Found in stress_test/monitor.py - About 1 hr to fix

        Function __poll_flows_ds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def __poll_flows_ds(self, t_start, expected_flows):
        """
        Monitors operational DS from the time the transmission starts from NB
        towards the controller until the expected number of flows are
        found or the deadline is reached.
        Severity: Minor
        Found in stress_test/monitor.py - About 1 hr to fix

        Function __poll_flows_switches has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def __poll_flows_switches(self, t_start, expected_flows):
        """
        Monitors installed flows into switches of Multinet from the first REST
        request, until the expected number of flows are found or the deadline
        is reached.
        Severity: Minor
        Found in stress_test/monitor.py - About 1 hr to fix

        Function monitor_results_add has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def monitor_results_add(self, add_controller_time,
        results_thread, total_failed_flows):
        """
        This monitor function is used to create the result dictionary during \
        an add flows action
        Severity: Minor
        Found in stress_test/monitor.py - About 1 hr to fix

          Function monitor_run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

          def monitor_run(self, reference_results=None, sample_id=None,
          boot_start_time=None):
          """
          This monitor function is used from both south bound active and idle \
          multinet tests to get the results from gevent queue
          Severity: Minor
          Found in stress_test/monitor.py - About 35 mins to fix

          Function monitor_results_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def monitor_results_add(self, add_controller_time,
          results_thread, total_failed_flows):
          """
          This monitor function is used to create the result dictionary during \
          an add flows action
          Severity: Minor
          Found in stress_test/monitor.py - About 25 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          if (time.time() - t_discovery_start) > \
          self.nbgen.flows_ds_discovery_deadline:
          logging.info('[NB_emulator] [Poll_flows thread] Deadline of '
          '{0} seconds passed'
          .format(self.nbgen.flows_ds_discovery_deadline))
          Severity: Major
          Found in stress_test/monitor.py and 1 other location - About 1 day to fix
          stress_test/monitor.py on lines 796..829

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          if (time.time() - t_discovery_start) > \
          self.nbgen.flows_ds_discovery_deadline:
          logging.info('[NB_emulator] [Poll_flows_confirm thread] '
          ' Deadline of {0} seconds passed'
          .format(self.flows_ds_discovery_deadline))
          Severity: Major
          Found in stress_test/monitor.py and 1 other location - About 1 day to fix
          stress_test/monitor.py on lines 743..776

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          if results_thread['end_to_end_flows_operation_time'] != -1:
          results['end_to_end_installation_rate'] = \
          float(self.nbgen.total_flows) / \
          results_thread['end_to_end_flows_operation_time']
          else:
          Severity: Major
          Found in stress_test/monitor.py and 2 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 1029..1034
          stress_test/monitor.py on lines 1037..1041

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          if results_thread['switch_operation_time'] != -1:
          results['add_switch_rate'] = \
          float(self.nbgen.total_flows) / \
          results_thread['switch_operation_time']
          else:
          Severity: Major
          Found in stress_test/monitor.py and 2 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 1018..1023
          stress_test/monitor.py on lines 1037..1041

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

          if results_thread['confirm_time'] != -1:
          results['add_confirm_rate'] = \
          float(self.nbgen.total_flows) / results_thread['confirm_time']
          else:
          results['add_confirm_rate'] = -1
          Severity: Major
          Found in stress_test/monitor.py and 2 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 1018..1023
          stress_test/monitor.py on lines 1029..1034

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          if (time.time() - t_discovery_start) > \
          self.nbgen.flows_ds_discovery_deadline:
          logging.info('[NB_emulator] [Poll_flows_switches thread] '
          'Deadline of {0} seconds passed'
          .format(self.flows_ds_discovery_deadline))
          Severity: Major
          Found in stress_test/monitor.py and 1 other location - About 2 hrs to fix
          stress_test/monitor.py on lines 796..806

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_out_packets_per_sec'] = \
          (abs(float(oftraf_monitor_results['tcp_of_out_traffic'][0])) -
          reference_results['tcp_of_out_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_in_packets_per_sec'] = \
          (abs(float(oftraf_monitor_results['of_in_traffic'][0])) -
          reference_results['of_in_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_out_bytes_per_sec'] = \
          (abs(float(oftraf_monitor_results['tcp_of_out_traffic'][1])) -
          reference_results['tcp_of_out_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_in_bytes_per_sec'] = \
          (abs(float(oftraf_monitor_results['of_in_traffic'][1])) -
          reference_results['of_in_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_in_bytes_per_sec'] = \
          (abs(float(oftraf_monitor_results['tcp_of_in_traffic'][1])) -
          reference_results['tcp_of_in_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_out_bytes_per_sec'] = \
          (abs(float(oftraf_monitor_results['of_out_traffic'][1])) -
          reference_results['of_out_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_out_packets_per_sec'] = \
          (abs(float(oftraf_monitor_results['of_out_traffic'][0])) -
          reference_results['of_out_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 645..647
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_in_packets_per_sec'] = \
          (abs(float(oftraf_monitor_results['tcp_of_in_traffic'][0])) -
          reference_results['tcp_of_in_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 2 hrs to fix
          stress_test/monitor.py on lines 627..629
          stress_test/monitor.py on lines 630..632
          stress_test/monitor.py on lines 633..635
          stress_test/monitor.py on lines 636..638
          stress_test/monitor.py on lines 639..641
          stress_test/monitor.py on lines 642..644
          stress_test/monitor.py on lines 648..650

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_in_packets_per_sec'] = \
          float(oftraf_monitor_results['of_in_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_in_bytes_per_sec'] = \
          float(oftraf_monitor_results['tcp_of_in_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_out_packets_per_sec'] = \
          float(oftraf_monitor_results['of_out_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_in_bytes_per_sec'] = \
          float(oftraf_monitor_results['of_in_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['of_out_bytes_per_sec'] = \
          float(oftraf_monitor_results['of_out_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_out_packets_per_sec'] = \
          float(oftraf_monitor_results['tcp_of_out_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_out_bytes_per_sec'] = \
          float(oftraf_monitor_results['tcp_of_out_traffic'][1]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 697..698
          stress_test/monitor.py on lines 699..700

          Similar blocks of code found in 8 locations. Consider refactoring.
          Open

          results['tcp_of_in_packets_per_sec'] = \
          float(oftraf_monitor_results['tcp_of_in_traffic'][0]) / traffic_gen_ms
          Severity: Major
          Found in stress_test/monitor.py and 7 other locations - About 35 mins to fix
          stress_test/monitor.py on lines 685..686
          stress_test/monitor.py on lines 687..688
          stress_test/monitor.py on lines 689..690
          stress_test/monitor.py on lines 691..692
          stress_test/monitor.py on lines 693..694
          stress_test/monitor.py on lines 695..696
          stress_test/monitor.py on lines 699..700
          Category
          Status