def test_add_oflows(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
              mock.Mock(return_value=(0, {}, ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.connection = ssh_mock
         ovs_obj.ovs = OVS
         self.assertIsNone(ovs_obj.add_oflows())
 def test_check_output(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         cmd = "command"
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, {}, ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.connection = ssh_mock
         self.assertIsNotNone(ovs_obj.check_output(cmd, None))
 def test_install_req_libs(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, {}, ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.first_run = True
         ovs_obj.connection = ssh_mock
         self.assertIsNone(ovs_obj.install_req_libs())
 def test_get_nic_details(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "eth0 eth1", ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.ovs = OVS
         ovs_obj.connection = ssh_mock
         self.assertIsNotNone(ovs_obj.get_nic_details())
 def test_destroy_vm_unsuccessful(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, {}, ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.connection = ssh_mock
         ovs_obj.ovs = OVS
         ovs_obj.check_output = mock.Mock(return_value=(1, {}))
         self.assertIsNone(ovs_obj.destroy_vm())
 def test_ssh_connection(self, mock_prov):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(1, "b", ""))
         ssh.return_value = ssh_mock
         mock_prov.provision_tool = mock.Mock()
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.connection = ssh_mock
         ovs_obj.ovs = OVS_PASSWORD
         self.assertIsNone(ovs_obj.ssh_remote_machine())
 def test_setup_ovs_context_vm_already_present(self):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, {}, ""))
         ssh.return_value = ssh_mock
         ovs_obj = ovsdpdk.Ovsdpdk()
         ovs_obj.connection = ssh_mock
         ovs_obj.ovs = OVS
         mock_ovs = mock.Mock()
         ssh_mock.put = mock.Mock()
         ovs_obj.check_output = mock.Mock(return_value=(0, "vm1"))
         with mock.patch(
                 "yardstick.benchmark.contexts.standalone.ovsdpdk.time"):
             self.assertIsNone(
                 ovs_obj.setup_ovs_context(PCIS, NIC_DETAILS, DRIVER))
 def test_write_to_file(self):
     ovs_obj = ovsdpdk.Ovsdpdk()
     self.assertIsNone(ovs_obj.write_to_file(SAMPLE_FILE, "some content"))
 def test_read_from_file(self):
     CORRECT_FILE_PATH = self._get_file_abspath(self.NODES_SAMPLE_PASSWORD)
     ovs_obj = ovsdpdk.Ovsdpdk()
     self.assertIsNotNone(ovs_obj.read_from_file(CORRECT_FILE_PATH))
 def test_split_cpu_list_null(self):
     with mock.patch("itertools.chain") as iter1:
         iter1 = mock.Mock()
         print("{0}".format(iter1))
         ovs_obj = ovsdpdk.Ovsdpdk()
         self.assertEqual(ovs_obj.split_cpu_list([]), [])
 def test_split_cpu_list_available(self):
     with mock.patch("itertools.chain") as iter1:
         iter1 = mock.Mock()
         print("{0}".format(iter1))
         ovs_obj = ovsdpdk.Ovsdpdk()
         self.assertIsNotNone(ovs_obj.split_cpu_list('0,5'))
 def setUp(self):
     self.test_context = ovsdpdk.Ovsdpdk()