intracom-telecom-sdn/nstat

View on GitHub
stress_test/sbemu.py

Summary

Maintainability
F
2 wks
Test Coverage

Showing 37 of 37 total issues

File sbemu.py has 800 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/sbemu.py - About 1 day to fix

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

    def get_switches(self, new_ssh_conn=None):
    """
    Wrapper to the Multinet SB-Emulator get_switches handler
     
    :param new_ssh_conn: an SSH client connection object
    Severity: Minor
    Found in stress_test/sbemu.py by radon

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

    def get_flows(self, new_ssh_conn=None):
    """
    Wrapper to the Multinet SB-Emulator get_flows handler
     
    :param new_ssh_conn: an SSH client connection object
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method build. (6)
    Open

    def build(self):
    """
    Wrapper to the SB-Emulator build handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method __generate_config. (6)
    Open

    def __generate_config(self, cntrl_of_port, cntrl_ip):
    """
    Generates a new json configuration file for multinet, according to the
    configuration values that are passed as parameters.
     
     
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method run. (6)
    Open

    def run(self, ctrl_ip, ctrl_sb_port, prefix='[MTCBench.run_handler]',
    lines_queue=None, print_flag=True, block_flag=True,
    getpty_flag=False):
    """
    Wrapper to the MTCBench SB-Emulator run handler
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method clean. (6)
    Open

    def clean(self):
    """
    Wrapper to the SB-Emulator clean handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method __parse_output. (6)
    Open

    def __parse_output(self, multinet_handler_name, multinet_output):
    """
    Gets the console output of a multinet handler and extracts the
    aggregated result from all workers, as a numeric value.
    (Helper function)
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method start_topos. (6)
    Open

    def start_topos(self):
    """
    Wrapper to the Multinet SB-Emulator start_topos handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method generate_traffic. (6)
    Open

    def generate_traffic(self):
    """
    Wrapper to the Multinet SB-Emulator traffic_gen handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method deploy. (6)
    Open

    def deploy(self, cntrl_ip, cntrl_of_port):
    """
    Wrapper to the Multinet SB-Emulator deploy handler
     
    :param cntrl_ip: The IP of the Controller.
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method init_topos. (6)
    Open

    def init_topos(self):
    """
    Wrapper to the Multinet SB-Emulator init_topos handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method stop_topos. (6)
    Open

    def stop_topos(self):
    """
    Wrapper to the Multinet SB-Emulator stop_topos handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

    Cyclomatic complexity is too high in method cleanup. (6)
    Open

    def cleanup(self):
    """
    Wrapper to the Multinet SB-Emulator cleanup handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/sbemu.py by radon

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

    def get_switches(self, new_ssh_conn=None):
    """
    Wrapper to the Multinet SB-Emulator get_switches handler
     
    :param new_ssh_conn: an SSH client connection object
    Severity: Minor
    Found in stress_test/sbemu.py - About 1 hr to fix

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

    def get_flows(self, new_ssh_conn=None):
    """
    Wrapper to the Multinet SB-Emulator get_flows handler
     
    :param new_ssh_conn: an SSH client connection object
    Severity: Minor
    Found in stress_test/sbemu.py - About 1 hr to fix

    Function run has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def run(self, ctrl_ip, ctrl_sb_port, prefix='[MTCBench.run_handler]',
    Severity: Major
    Found in stress_test/sbemu.py - About 50 mins to fix

      Function clean has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def clean(self):
      """
      Wrapper to the SB-Emulator clean handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 45 mins to fix

      Function build has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def build(self):
      """
      Wrapper to the SB-Emulator build handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 45 mins to fix

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

      def run(self, ctrl_ip, ctrl_sb_port, prefix='[MTCBench.run_handler]',
      lines_queue=None, print_flag=True, block_flag=True,
      getpty_flag=False):
      """
      Wrapper to the MTCBench SB-Emulator run handler
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def generate_traffic(self):
      """
      Wrapper to the Multinet SB-Emulator traffic_gen handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def start_topos(self):
      """
      Wrapper to the Multinet SB-Emulator start_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def init_topos(self):
      """
      Wrapper to the Multinet SB-Emulator init_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def cleanup(self):
      """
      Wrapper to the Multinet SB-Emulator cleanup handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def deploy(self, cntrl_ip, cntrl_of_port):
      """
      Wrapper to the Multinet SB-Emulator deploy handler
       
      :param cntrl_ip: The IP of the Controller.
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def stop_topos(self):
      """
      Wrapper to the Multinet SB-Emulator stop_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Minor
      Found in stress_test/sbemu.py - About 35 mins to fix

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

      def __init__(self, sb_emu_base_dir, test_config):
      """
      Initialize the creation of an Multinet SB emulator object.
      Inherits from SBEmu class.
       
       
      Severity: Minor
      Found in stress_test/sbemu.py - About 25 mins to fix

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

      def generate_traffic(self):
      """
      Wrapper to the Multinet SB-Emulator traffic_gen handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Major
      Found in stress_test/sbemu.py and 4 other locations - About 2 days to fix
      stress_test/sbemu.py on lines 674..711
      stress_test/sbemu.py on lines 713..750
      stress_test/sbemu.py on lines 752..788
      stress_test/sbemu.py on lines 790..827

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

      def init_topos(self):
      """
      Wrapper to the Multinet SB-Emulator init_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Major
      Found in stress_test/sbemu.py and 4 other locations - About 2 days to fix
      stress_test/sbemu.py on lines 713..750
      stress_test/sbemu.py on lines 752..788
      stress_test/sbemu.py on lines 790..827
      stress_test/sbemu.py on lines 829..868

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

      def stop_topos(self):
      """
      Wrapper to the Multinet SB-Emulator stop_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Major
      Found in stress_test/sbemu.py and 4 other locations - About 2 days to fix
      stress_test/sbemu.py on lines 674..711
      stress_test/sbemu.py on lines 713..750
      stress_test/sbemu.py on lines 790..827
      stress_test/sbemu.py on lines 829..868

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

      def cleanup(self):
      """
      Wrapper to the Multinet SB-Emulator cleanup handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Major
      Found in stress_test/sbemu.py and 4 other locations - About 2 days to fix
      stress_test/sbemu.py on lines 674..711
      stress_test/sbemu.py on lines 713..750
      stress_test/sbemu.py on lines 752..788
      stress_test/sbemu.py on lines 829..868

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

      def start_topos(self):
      """
      Wrapper to the Multinet SB-Emulator start_topos handler
       
      :raises IOError: if the handler does not exist on the remote host
      Severity: Major
      Found in stress_test/sbemu.py and 4 other locations - About 2 days to fix
      stress_test/sbemu.py on lines 674..711
      stress_test/sbemu.py on lines 752..788
      stress_test/sbemu.py on lines 790..827
      stress_test/sbemu.py on lines 829..868

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

      def init_ssh(self):
      """
      Initializes a new SSH client object, with the emulator node and \
      assigns it to the protected attribute _ssh_conn. If a connection \
      already exists it returns a new SSH client object to the \
      Severity: Major
      Found in stress_test/sbemu.py and 2 other locations - About 1 day to fix
      stress_test/controller.py on lines 107..135
      stress_test/nbemu.py on lines 100..127

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

      def _error_handling(self, error_message, error_num=1):
      """
      Handles custom errors of sb emulators
       
      :param error_message: message of the handled error
      Severity: Major
      Found in stress_test/sbemu.py and 3 other locations - About 6 hrs to fix
      stress_test/controller.py on lines 83..105
      stress_test/nbemu.py on lines 77..98
      stress_test/oftraf.py on lines 49..71

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

      def __del__(self):
      """
      Method called when object is destroyed
      """
      try:
      Severity: Major
      Found in stress_test/sbemu.py and 1 other location - About 5 hrs to fix
      stress_test/nbemu.py on lines 261..275

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

      if exit_status == 0:
      logging.info("[Multinet] Successful got switches")
      return self.__parse_output('get_switches_topology_handler',
      cmd_output)
      else:
      Severity: Major
      Found in stress_test/sbemu.py and 1 other location - About 1 hr to fix
      stress_test/sbemu.py on lines 659..666

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

      if exit_status == 0:
      logging.info("[Multinet] Successful got flows")
      return self.__parse_output('get_flows_topology_handler',
      cmd_output)
      else:
      Severity: Major
      Found in stress_test/sbemu.py and 1 other location - About 1 hr to fix
      stress_test/sbemu.py on lines 608..615

      There are no issues that match your filters.

      Category
      Status