intracom-telecom-sdn/nstat

View on GitHub
stress_test/nbemu.py

Summary

Maintainability
F
4 days
Test Coverage

Showing 13 of 13 total issues

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

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

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

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

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

def run(self):
"""
Wrapper to the NB-Generator run handler
 
:returns: Returns the combined stdout - stderr of the executed command
Severity: Minor
Found in stress_test/nbemu.py by radon

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

def __init__(self, nb_gen_base_dir, test_config, controller, sbemu,
log_level="DEBUG"):
"""Create an NB-generator object. Options from JSON input file
 
:param nb_gen_base_dir: emulator base directory
Severity: Minor
Found in stress_test/nbemu.py - About 1 hr to fix

    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def __init__(self, nb_gen_base_dir, test_config, controller, sbemu,
    Severity: Minor
    Found in stress_test/nbemu.py - About 35 mins to fix

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

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

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

      def run(self):
      """
      Wrapper to the NB-Generator run handler
       
      :returns: Returns the combined stdout - stderr of the executed command
      Severity: Minor
      Found in stress_test/nbemu.py - About 35 mins to fix

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

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

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

      def init_ssh(self):
      """
      Initializes a new SSH client object, with the nb_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/nbemu.py and 2 other locations - About 1 day to fix
      stress_test/controller.py on lines 107..135
      stress_test/sbemu.py on lines 97..124

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

      try:
      if not util.netutil.isfile(self.ip, self.ssh_port,
      self.ssh_user, self.ssh_pass,
      [self.clean_hnd]):
      raise(IOError(
      Severity: Major
      Found in stress_test/nbemu.py and 1 other location - About 1 day to fix
      stress_test/controller.py on lines 147..168

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

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

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

      def __del__(self):
      """
      Method called when object is destroyed"""
      try:
      logging.info('Cleaning NB-Generator.')
      Severity: Major
      Found in stress_test/nbemu.py and 1 other location - About 5 hrs to fix
      stress_test/sbemu.py on lines 199..213

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

      try:
      if not util.netutil.isfile(self.ip, self.ssh_port,
      self.ssh_user, self.ssh_pass,
      [self.build_hnd]):
      raise(IOError(
      Severity: Major
      Found in stress_test/nbemu.py and 1 other location - About 1 hr to fix
      stress_test/nbemu.py on lines 177..201
      Category
      Status