Beispiel #1
0
    def test_vnf_execute_command(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        acl_approx_vnf = AclApproxVnf(name, vnfd)
        acl_approx_vnf.q_in = mock.MagicMock()
        acl_approx_vnf.q_out = mock.MagicMock()
        acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
        cmd = "quit"
        self.assertEqual("", acl_approx_vnf.vnf_execute(cmd))
Beispiel #2
0
    def test_get_stats(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        acl_approx_vnf = AclApproxVnf(name, vnfd)
        acl_approx_vnf.q_in = mock.MagicMock()
        acl_approx_vnf.q_out = mock.MagicMock()
        acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
        result = "ACL TOTAL: pkts_processed: 100, pkts_drop: 0, spkts_received: 100"
        acl_approx_vnf.vnf_execute = mock.Mock(return_value=result)
        self.assertEqual(result, acl_approx_vnf.get_stats())
Beispiel #3
0
    def test_collect_kpi(self, ssh, *args):
        mock_ssh(ssh)

        vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
        acl_approx_vnf = AclApproxVnf(name, vnfd)
        acl_approx_vnf.q_in = mock.MagicMock()
        acl_approx_vnf.q_out = mock.MagicMock()
        acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
        acl_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
        acl_approx_vnf.vnf_execute = mock.Mock(return_value="")
        result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0}
        self.assertEqual(result, acl_approx_vnf.collect_kpi())
Beispiel #4
0
 def test_vnf_execute_command(self, mock_time, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         acl_approx_vnf = AclApproxVnf(name, vnfd)
         acl_approx_vnf.q_in = mock.MagicMock()
         acl_approx_vnf.q_out = mock.MagicMock()
         acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
         cmd = "quit"
         self.assertEqual("", acl_approx_vnf.vnf_execute(cmd))
Beispiel #5
0
 def test_get_stats(self, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         acl_approx_vnf = AclApproxVnf(name, vnfd)
         acl_approx_vnf.q_in = mock.MagicMock()
         acl_approx_vnf.q_out = mock.MagicMock()
         acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
         mock_result = \
             "ACL TOTAL: pkts_processed: 100, pkts_drop: 0, spkts_received: 100"
         acl_approx_vnf.vnf_execute = mock.Mock(return_value=mock_result)
         self.assertEqual(mock_result, acl_approx_vnf.get_stats())
Beispiel #6
0
 def test_collect_kpi(self, mock_time, mock_process):
     with mock.patch("yardstick.ssh.SSH") as ssh:
         ssh_mock = mock.Mock(autospec=ssh.SSH)
         ssh_mock.execute = \
             mock.Mock(return_value=(0, "", ""))
         ssh.from_node.return_value = ssh_mock
         vnfd = self.VNFD['vnfd:vnfd-catalog']['vnfd'][0]
         acl_approx_vnf = AclApproxVnf(name, vnfd)
         acl_approx_vnf.q_in = mock.MagicMock()
         acl_approx_vnf.q_out = mock.MagicMock()
         acl_approx_vnf.q_out.qsize = mock.Mock(return_value=0)
         acl_approx_vnf.resource = mock.Mock(autospec=ResourceProfile)
         acl_approx_vnf.vnf_execute = mock.Mock(return_value="")
         result = {'packets_dropped': 0, 'packets_fwd': 0, 'packets_in': 0}
         self.assertEqual(result, acl_approx_vnf.collect_kpi())