intracom-telecom-sdn/nstat

View on GitHub
stress_test/oftraf.py

Summary

Maintainability
F
4 days
Test Coverage

Showing 19 of 19 total issues

File oftraf.py has 282 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: Minor
Found in stress_test/oftraf.py - About 2 hrs to fix

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

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

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

    def stop(self):
    """ Wrapper to the oftraf monitor stop handler
     
    :raises IOError: if the handler does not exist on the remote host
    :raises oftraf_exceptions.OftrafStopError: if stop process fails
    Severity: Minor
    Found in stress_test/oftraf.py by radon

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

    def start(self):
    """
    Wrapper to the oftraf monitor start handler. Initializes the REST
    interface of oftraf and listen of traffic on controller Southbound
    interface
    Severity: Minor
    Found in stress_test/oftraf.py by radon

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

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

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

    def clean(self):
    """
    Wrapper to the oftraf monitor clean handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/oftraf.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 oftraf monitor build handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/oftraf.py - About 35 mins to fix

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

    def start(self):
    """
    Wrapper to the oftraf monitor start handler. Initializes the REST
    interface of oftraf and listen of traffic on controller Southbound
    interface
    Severity: Minor
    Found in stress_test/oftraf.py - About 35 mins to fix

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

    def stop(self):
    """ Wrapper to the oftraf monitor stop handler
     
    :raises IOError: if the handler does not exist on the remote host
    :raises oftraf_exceptions.OftrafStopError: if stop process fails
    Severity: Minor
    Found in stress_test/oftraf.py - About 35 mins to fix

    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/oftraf.py and 1 other location - About 1 day to fix
    stress_test/controller.py on lines 506..529

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

    def _error_handling(self, error_message, error_num=1):
    """
    Handles custom errors of oftraf
     
    :param error_message: message of the handled error
    Severity: Major
    Found in stress_test/oftraf.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/sbemu.py on lines 74..95

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

    if not util.netutil.isfile(self.ip, self.ssh_port,
    self.ssh_user, self.ssh_pass,
    [clean_hnd]):
    raise(IOError(
    '{0} clean handler does not exist'.
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 3 hrs to fix
    stress_test/oftraf.py on lines 101..112
    stress_test/oftraf.py on lines 185..194
    stress_test/oftraf.py on lines 229..238

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

    if not util.netutil.isfile(self.ip,
    self.ssh_port,
    self.ssh_user,
    self.ssh_pass,
    [build_hnd]):
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 3 hrs to fix
    stress_test/oftraf.py on lines 143..152
    stress_test/oftraf.py on lines 185..194
    stress_test/oftraf.py on lines 229..238

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

    if not util.netutil.isfile(self.ip, self.ssh_port,
    self.ssh_user, self.ssh_pass,
    [start_hnd]):
    raise(IOError(
    '{0} start handler does not exist'.
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 3 hrs to fix
    stress_test/oftraf.py on lines 101..112
    stress_test/oftraf.py on lines 143..152
    stress_test/oftraf.py on lines 229..238

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

    if not util.netutil.isfile(self.ip, self.ssh_port,
    self.ssh_user, self.ssh_pass,
    [stop_hnd]):
    raise(IOError(
    '{0} stop handler does not exist'.
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 3 hrs to fix
    stress_test/oftraf.py on lines 101..112
    stress_test/oftraf.py on lines 143..152
    stress_test/oftraf.py on lines 185..194

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

    if exit_status == 0:
    logging.info("[Oftraf] Successful stopping")
    else:
    raise(stress_test.oftraf_exceptions.OftrafStopError(
    'Stop process exited with non zero exit code. '
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 1 hr to fix
    stress_test/oftraf.py on lines 117..123
    stress_test/oftraf.py on lines 157..163
    stress_test/oftraf.py on lines 204..210

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

    if exit_status == 0:
    logging.info("[OFTraf] Successful building")
    else:
    raise(stress_test.oftraf_exceptions.OftrafBuildError(
    'Build process exited with non zero exit code. '
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 1 hr to fix
    stress_test/oftraf.py on lines 157..163
    stress_test/oftraf.py on lines 204..210
    stress_test/oftraf.py on lines 246..252

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

    if exit_status == 0:
    logging.info("[Oftraf] Successful starting")
    else:
    raise(stress_test.oftraf_exceptions.OftrafStartError(
    'Start process exited with non zero exit code. '
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 1 hr to fix
    stress_test/oftraf.py on lines 117..123
    stress_test/oftraf.py on lines 157..163
    stress_test/oftraf.py on lines 246..252

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

    if exit_status == 0:
    logging.info("[Oftraf] Successful cleaning")
    else:
    raise(stress_test.oftraf_exceptions.OftrafCleanError(
    'clean process exited with non zero exit code. '
    Severity: Major
    Found in stress_test/oftraf.py and 3 other locations - About 1 hr to fix
    stress_test/oftraf.py on lines 117..123
    stress_test/oftraf.py on lines 204..210
    stress_test/oftraf.py on lines 246..252

    There are no issues that match your filters.

    Category
    Status