def setUpClass(self):
        self.ovs_obj = ovs(IP=config.SWITCH_IP, username= config.SWITCH_USER, password= config.SWITCH_PASSWORD,root_password=config.SWITCH_ROOT_PSWD)

        if config.MININET:
            self.mn = SSHConnection(IP=config.SWITCH_IP, username= config.SWITCH_USER, password= config.SWITCH_PASSWORD)
            self.MN=self.mn.connect()
            self.mn.execute_command(cmd="sudo su", exp_out=":")
            self.mn.execute_command(cmd=config.SWITCH_ROOT_PSWD, exp_out="#")
 def e_TrafficGenerator(self):
     """
     1. Execute the iperf command on the Client(Source) machine with type of traffic to be generated
     :return: None
     """
     ovs_intf = ovs(IP=config.HOST1_IP,
                    username=config.HOST1_USER,
                    password=config.HOST1_PASSWORD)
     traffic = ovs_intf.iperf_client(client=config.CLIENT_IP,
                                     client_username=config.CLIENT_USER,
                                     client_password=config.CLIENT_PASSWORD,
                                     serverip=config.HOST1_IP)
     return traffic
    def v_VerifyConfigFlows(self, open_flow_version, protocol, protocolType,
                            interface):
        """
        1. Verify OpenFlow version
        2. Verify the configured flow executing the open flow dump commands on the rasberryPI device.
        :return: Output of the Dump flow command.
        """
        status = True
        ovs_intf = ovs(IP=config.SWITCH_IP,
                       username=config.SWITCH_USER,
                       password=config.SWITCH_PASSWORD)

        exp_version = open_flow_version
        actual_version = ovs_intf.version()

        status &= True if exp_version == actual_version else False

        if status:
            flow_info = None
            print "\nflow_info 1 = ", flow_info
            flow_info = ovs_intf.get_flows(protocol=protocol,
                                           protocolType=protocolType,
                                           interface=interface)
            print "\nflow_info 2= ", flow_info

            if flow_info:

                for flow in flow_info:

                    try:
                        actual_protocol = flow["priority"].split(",")[1].split(
                            " ")[0]
                    except IndexError:
                        actual_protocol = None
                    if protocolType != actual_protocol:
                        status &= False
                        print("Protocol Mismatch. Expected {0} but found {1}".
                              format(protocolType, actual_protocol))
            else:
                status &= False
                print("No flow found for configured Protocol: {0}".format(
                    protocolType))
        else:
            status &= False
            print("Version Information mismatch. Found {0} instead of {1}".
                  format(actual_version, exp_version))

        return status
    def setUpClass(self):
        self.mini = False
        self.ovs_obj = ovs(IP=config.SWITCH_IP,
                           username=config.SWITCH_USER,
                           password=config.SWITCH_PASSWORD,
                           root_password=config.SWITCH_ROOT_PSWD)

        if config.MININET:
            self.mn = MininetInterface.MininetConnection(
                IP=config.SWITCH_IP,
                username=config.SWITCH_USER,
                password=config.SWITCH_PASSWORD)
            self.MN = self.mn.connect(controller="remote",
                                      contIP=config.CONTROLLER_IP,
                                      customScript="/home/test/custom.py",
                                      topo="Switch2")
            if self.MN: self.mini = True
Exemplo n.º 5
0
    def v_VerifyConfigFlows(self, open_flow_version, protocol, protocolType,
                            interface):
        """
        1. Verify OpenFlow version
        2. Verify the configured flow executing the open flow dump commands on the rasberryPI device.
        :return: Output of the Dump flow command.
        """
        status = True
        ovs_intf = ovs(IP=config.HOST1_IP,
                       username=config.MININET_USER,
                       password=config.MININET_PASS)
        exp_version = open_flow_version
        actual_version = ovs_intf.version()

        status &= True if exp_version == actual_version else False
        if status:
            status &= ovs_intf.dumpflows(protocol=protocol,
                                         protocolType=protocolType,
                                         interface=interface)
            return ovs_intf.rc.resp if status else None
        else:
            print("Version Information mismatch. Found {0} instead of {1}".
                  format(actual_version, exp_version))
Exemplo n.º 6
0
 def setUp(self):
     print 'Setup->'
     self.S1 = ovs.ovs(IP=IP, username=usr, password=pwd)
 def setUpClass(self):
     self.ovs_obj = ovs(IP=config.SWITCH_IP,
                        username=config.SWITCH_USER,
                        password=config.SWITCH_PASSWORD)