intracom-telecom-sdn/nstat

View on GitHub
stress_test/controller.py

Summary

Maintainability
F
2 wks
Test Coverage

Showing 35 of 35 total issues

File controller.py has 866 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/controller.py - About 2 days to fix

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

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

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

    def get_oper_switches(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_switches handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    switches of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py by radon

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

    def get_oper_flows(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_flows handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    flows of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py by radon

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

    def check_status(self):
    """
    Wrapper to the controller status handler
     
    :returns: the status of the controller (running = 1, not running = 0)
    Severity: Minor
    Found in stress_test/controller.py by radon

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

    def wait_until_listens(self, timeout_ms):
    """
    Waits for controller to start listening on specified port.
     
    :param timeout_ms: milliseconds to wait (in milliseconds).
    Severity: Minor
    Found in stress_test/controller.py by radon

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

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

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

    def get_oper_hosts(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_hosts handler. Makes a REST call to \
    the NB interface of the controller and returns the number of hosts \
    of the topology, recorded in operational datastore of the controller
    Severity: Minor
    Found in stress_test/controller.py by radon

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

    def get_oper_links(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_links handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    links of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py by radon

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

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

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

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

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

    def wait_until_up(self, timeout_ms):
    """
    Waits for controller status to become 1 (started).
     
    :param timeout_ms: milliseconds to wait (in milliseconds).
    Severity: Minor
    Found in stress_test/controller.py by radon

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

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

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

    def start(self):
    """
    Wrapper to the controller start handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/controller.py - About 1 hr to fix

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

    def stop(self):
    """
    Wrapper to the controller stop handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/controller.py - About 1 hr to fix

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

    def check_status(self):
    """
    Wrapper to the controller status handler
     
    :returns: the status of the controller (running = 1, not running = 0)
    Severity: Minor
    Found in stress_test/controller.py - About 45 mins to fix

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

    def get_oper_switches(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_switches handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    switches of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py - About 45 mins to fix

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

    def get_oper_flows(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_flows handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    flows of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py - About 45 mins to fix

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

    def get_oper_links(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_links handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    links of the topology, recorded in operational datastore of the \
    Severity: Minor
    Found in stress_test/controller.py - About 45 mins to fix

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

    def get_oper_hosts(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_hosts handler. Makes a REST call to \
    the NB interface of the controller and returns the number of hosts \
    of the topology, recorded in operational datastore of the controller
    Severity: Minor
    Found in stress_test/controller.py - About 45 mins to fix

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

    def wait_until_listens(self, timeout_ms):
    """
    Waits for controller to start listening on specified port.
     
    :param timeout_ms: milliseconds to wait (in milliseconds).
    Severity: Minor
    Found in stress_test/controller.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 controller build handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/controller.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 controller cleanup handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Minor
    Found in stress_test/controller.py - About 35 mins to fix

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

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

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

    def wait_until_up(self, timeout_ms):
    """
    Waits for controller status to become 1 (started).
     
    :param timeout_ms: milliseconds to wait (in milliseconds).
    Severity: Minor
    Found in stress_test/controller.py - About 25 mins to fix

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

    def get_oper_switches(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_switches handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    switches of the topology, recorded in operational datastore of the \
    Severity: Major
    Found in stress_test/controller.py and 3 other locations - About 2 days to fix
    stress_test/controller.py on lines 698..746
    stress_test/controller.py on lines 800..849
    stress_test/controller.py on lines 851..900

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

    def get_oper_links(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_links handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    links of the topology, recorded in operational datastore of the \
    Severity: Major
    Found in stress_test/controller.py and 3 other locations - About 2 days to fix
    stress_test/controller.py on lines 698..746
    stress_test/controller.py on lines 748..798
    stress_test/controller.py on lines 851..900

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

    def get_oper_hosts(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_hosts handler. Makes a REST call to \
    the NB interface of the controller and returns the number of hosts \
    of the topology, recorded in operational datastore of the controller
    Severity: Major
    Found in stress_test/controller.py and 3 other locations - About 2 days to fix
    stress_test/controller.py on lines 748..798
    stress_test/controller.py on lines 800..849
    stress_test/controller.py on lines 851..900

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

    def get_oper_flows(self, new_ssh_conn=None):
    """
    Wrapper to the controller oper_flows handler. Makes a REST call \
    to the NB interface of the controller and returns the number of \
    flows of the topology, recorded in operational datastore of the \
    Severity: Major
    Found in stress_test/controller.py and 3 other locations - About 2 days to fix
    stress_test/controller.py on lines 698..746
    stress_test/controller.py on lines 748..798
    stress_test/controller.py on lines 800..849

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

    def getcontroller(self):
    """
    Wrapper to the get controller handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Major
    Found in stress_test/controller.py and 1 other location - About 2 days to fix
    stress_test/controller.py on lines 396..432

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

    def build(self):
    """
    Wrapper to the controller build handler
     
    :raises IOError: if the handler does not exist on the remote host
    Severity: Major
    Found in stress_test/controller.py and 1 other location - About 2 days to fix
    stress_test/controller.py on lines 357..394

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

    def init_ssh(self):
    """
    Initializes a new SSH client object, with the controller 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/controller.py and 2 other locations - About 1 day to fix
    stress_test/nbemu.py on lines 100..127
    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/controller.py and 1 other location - About 1 day to fix
    stress_test/nbemu.py on lines 177..197

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

    def __del__(self):
    """
    Method called when object is destroyed. Cleanup activities are
    triggered and open connections closed
    """
    Severity: Major
    Found in stress_test/controller.py and 1 other location - About 1 day to fix
    stress_test/oftraf.py on lines 288..310

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

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

    There are no issues that match your filters.

    Category
    Status