intracom-telecom-sdn/multinet

View on GitHub

Showing 18 of 32 total issues

File multinet.py has 320 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2015 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 net/multinet.py - About 3 hrs to fix

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

        def buildFromTopo(self, topo=None):
            """
            Build mininet from a topology object
            At the end of this function, everything should be connected and up.
            Use the dpid offset to distinguise the nodes between Multinet Instances
    Severity: Minor
    Found in net/multinet.py - About 2 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def generate_traffic(self):
            """
            Traffic generation from switches to controller
            """
    
    
    Severity: Minor
    Found in net/multinet.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function broadcast_cmd has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def broadcast_cmd(worker_ip_list, worker_port_list, opcode, data=None):
        """Broadcast a POST request to all the workers
        Use multiple processes to send POST requests to a specified
        endpoint of all the workers simultaneously.
    
    
    Severity: Minor
    Found in util/multinet_requests.py - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

        def __init__(self, controller_ip, controller_port, switch_type, topo_type,
    Severity: Major
    Found in net/multinet.py - About 1 hr to fix

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

          def start_topology(self):
              """
              Start controller and switches.
              Do a gradual bootup.
              """
      Severity: Minor
      Found in net/multinet.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function ssh_copy_file_to_target has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ssh_copy_file_to_target(ipaddr, user, passwd, local_file, remote_file,
      Severity: Minor
      Found in util/netutil.py - About 45 mins to fix

        Function copy_directory_to_target has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def copy_directory_to_target(ipaddr, user, passwd, local_path, remote_path,
        Severity: Minor
        Found in util/netutil.py - About 45 mins to fix

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

          def make_remote_file_executable(ipaddr, user, passwd, remote_file,
          Severity: Minor
          Found in util/netutil.py - About 35 mins to fix

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

            def make_post_request_runner(host_ip, host_port, route, data, queue):
            Severity: Minor
            Found in util/multinet_requests.py - About 35 mins to fix

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

              def genHostName(i, j, dpid, n, k):
              Severity: Minor
              Found in net/topologies.py - About 35 mins to fix

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

                def ssh_connect_or_return(ipaddr, user, passwd, maxretries, remote_port=22):
                Severity: Minor
                Found in util/netutil.py - About 35 mins to fix

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

                  def remove_remote_directory(ipaddr, user, passwd, path, remote_port=22):
                  Severity: Minor
                  Found in util/netutil.py - About 35 mins to fix

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

                    def create_remote_directory(ipaddr, user, passwd, remote_path, remote_port=22):
                    Severity: Minor
                    Found in util/netutil.py - About 35 mins to fix

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

                      def ssh_delete_file_if_exists(ipaddr, user, passwd, remote_file,
                      Severity: Minor
                      Found in util/netutil.py - About 35 mins to fix

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

                            def build(self, k=2, n=1, dpid=1, **_opts):
                                """k: number of switches
                                   n: number of hosts per switch"""
                                self.k = k
                                self.n = n
                        Severity: Minor
                        Found in net/topologies.py - About 35 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                            def get_flows(self):
                                """
                                Getting flows from switches
                                """
                                logging.info('[get_flows] Getting flows from switches.')
                        Severity: Minor
                        Found in net/multinet.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

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

                        def copy_directory_to_target(ipaddr, user, passwd, local_path, remote_path,
                                                     remote_port=22):
                            """Copy a local directory on a remote machine.
                        
                            :param ipaddr: IP adress of the remote machine
                        Severity: Minor
                        Found in util/netutil.py - About 25 mins to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language