summaryrefslogtreecommitdiffstats
path: root/tests/unit/benchmark
diff options
context:
space:
mode:
authorBindya Narayan <bindya.narayan@intel.com>2017-05-30 15:09:10 +0530
committerBindya N <bindya.narayan@intel.com>2017-07-24 17:20:23 +0530
commit11a136fdbdc2a0440092a212ea21c58d50c39aad (patch)
tree2dc9e7509092ec98814327492142107778b56cd0 /tests/unit/benchmark
parentf32f0fe4bfb370d7336e890c0c12322d2be2d587 (diff)
Setup OVS-DPDK Standalone Context
This patch performs following tasks - getting dpdk_nic_bind path - setup ovs,dpdk ports,vhostuserports, - creation of vm, - apache2 licence - test cases for ovsdpdk - Changes to standalone context - update unit test cases Change-Id: I54e4062eb440b8677625e4abe6e0579d9fd54d41 Signed-off-by: Bindya N <bindya.narayan@intel.com>
Diffstat (limited to 'tests/unit/benchmark')
-rw-r--r--tests/unit/benchmark/contexts/nodes_duplicate_sample_new.yaml86
-rw-r--r--tests/unit/benchmark/contexts/nodes_duplicate_sample_ovs.yaml63
-rw-r--r--tests/unit/benchmark/contexts/nodes_sample_new_sriov.yaml82
-rw-r--r--tests/unit/benchmark/contexts/nodes_sample_ovs.yaml104
-rw-r--r--tests/unit/benchmark/contexts/nodes_sample_ovsdpdk.yaml104
-rw-r--r--tests/unit/benchmark/contexts/ovs_sample_password.yaml104
-rw-r--r--tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml69
-rw-r--r--tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt1
-rw-r--r--tests/unit/benchmark/contexts/test_ovsdpdk.py328
-rw-r--r--tests/unit/benchmark/contexts/test_standalone.py462
10 files changed, 1281 insertions, 122 deletions
diff --git a/tests/unit/benchmark/contexts/nodes_duplicate_sample_new.yaml b/tests/unit/benchmark/contexts/nodes_duplicate_sample_new.yaml
index 48f4065a2..306915ca1 100644
--- a/tests/unit/benchmark/contexts/nodes_duplicate_sample_new.yaml
+++ b/tests/unit/benchmark/contexts/nodes_duplicate_sample_new.yaml
@@ -1,43 +1,7 @@
-# Copyright (c) 2016-2017 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
nodes:
-
- name: trafficgen_1
- role: TrafficGen
- ip: 10.123.123.123
- user: root
- auth_type: password
- password: password
- interfaces:
- xe0: # logical name from topology.yaml and vnfd.yaml
- vpci: "0000:03:00.0"
- driver: ixgbe
- dpdk_port_num: 0
- local_ip: "152.16.100.20"
- netmask: "255.255.255.0"
- local_mac: "00:00:00:00:00:00"
- xe1: # logical name from topology.yaml and vnfd.yaml
- vpci: "0000:03:00.1"
- driver: ixgbe
- dpdk_port_num: 1
- local_ip: "152.16.100.21"
- netmask: "255.255.255.0"
- local_mac: "00:00:00:00:00:00"
--
name: sriov
- role: Sriov
+ role: Sriov1
ip: 10.123.123.122
user: root
auth_type: password
@@ -50,10 +14,9 @@ nodes:
- "0000:06:00.1"
phy_driver: i40e # kernel driver
images: "/var/lib/libvirt/images/ubuntu1.img"
-
-
name: sriov
- role: Sriov
+ role: Sriov1
ip: 10.123.123.111
user: root
auth_type: password
@@ -65,48 +28,5 @@ nodes:
- "0000:06:00.0"
- "0000:06:00.1"
phy_driver: i40e # kernel driver
- images: "/var/lib/libvirt/images/ubuntu1.img"
-
--
- name: vnf
- role: vnf
- ip: 10.123.123.121
- user: root
- auth_type: password
- password: password
- host: 10.123.123.121 #BM host == ip, SRIOV & ovs-dpdk host == compute node.
- interfaces:
- xe0: # logical name from topology.yaml and vnfd.yaml
- vpci: "0000:06:00.0"
- driver: i40e
- dpdk_port_num: 0
- local_ip: "152.16.100.19"
- netmask: "255.255.255.0"
- local_mac: "00:00:00:00:00:00"
+ images: "/var/lib/libvirt/images/ubuntu1.img"
- xe1: # logical name from topology.yaml and vnfd.yaml
- vpci: "0000:06:00.1"
- driver: i40e
- dpdk_port_num: 1
- local_ip: "152.16.40.19"
- netmask: "255.255.255.0"
- local_mac: "00:00:00:00:00:00"
- routing_table:
- - network: "152.16.100.20"
- netmask: "255.255.255.0"
- gateway: "152.16.100.20"
- if: "xe0"
- - network: "152.16.40.20"
- netmask: "255.255.255.0"
- gateway: "152.16.40.20"
- if: "xe1"
- nd_route_tbl:
- - network: "0064:ff9b:0:0:0:0:9810:6414"
- netmask: "112"
- gateway: "0064:ff9b:0:0:0:0:9810:6414"
- if: "xe0"
- - network: "0064:ff9b:0:0:0:0:9810:2814"
- netmask: "112"
- gateway: "0064:ff9b:0:0:0:0:9810:2814"
- if: "xe1"
-
diff --git a/tests/unit/benchmark/contexts/nodes_duplicate_sample_ovs.yaml b/tests/unit/benchmark/contexts/nodes_duplicate_sample_ovs.yaml
new file mode 100644
index 000000000..65449c91c
--- /dev/null
+++ b/tests/unit/benchmark/contexts/nodes_duplicate_sample_ovs.yaml
@@ -0,0 +1,63 @@
+# Copyright (c) 2016 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+nodes:
+-
+ name: ovs
+ role: test
+ ip: 10.223.197.222
+ user: root
+ auth_type: password
+ password: intel123
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+-
+ name: ovs
+ role: test
+ ip: 10.223.197.112
+ user: root
+ auth_type: password
+ password: intel123
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
diff --git a/tests/unit/benchmark/contexts/nodes_sample_new_sriov.yaml b/tests/unit/benchmark/contexts/nodes_sample_new_sriov.yaml
new file mode 100644
index 000000000..55ff2e778
--- /dev/null
+++ b/tests/unit/benchmark/contexts/nodes_sample_new_sriov.yaml
@@ -0,0 +1,82 @@
+nodes:
+-
+ name: trafficgen_1
+ role: TrafficGen
+ ip: 10.123.123.123
+ user: root
+ auth_type: password
+ password: password
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.0"
+ driver: ixgbe
+ dpdk_port_num: 0
+ local_ip: "152.16.100.20"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:00"
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.1"
+ driver: ixgbe
+ dpdk_port_num: 1
+ local_ip: "152.16.100.21"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:00"
+-
+ name: sriov
+ role: Sriov1
+ ip: 10.123.123.122
+ user: root
+ auth_type: password
+ password: password
+ vf_macs:
+ - "00:00:00:00:00:00"
+ - "00:00:00:00:00:00"
+ phy_ports: # Physical ports to configure sriov
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
+-
+ name: vnf
+ role: vnf
+ ip: 10.123.123.121
+ user: root
+ auth_type: password
+ password: password
+ host: 10.123.123.121 #BM host == ip, SRIOV & ovs-dpdk host == compute node.
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:06:00.0"
+ driver: i40e
+ dpdk_port_num: 0
+ local_ip: "152.16.100.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:00"
+
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:06:00.1"
+ driver: i40e
+ dpdk_port_num: 1
+ local_ip: "152.16.40.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:00"
+ routing_table:
+ - network: "152.16.100.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.100.20"
+ if: "xe0"
+ - network: "152.16.40.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.40.20"
+ if: "xe1"
+ nd_route_tbl:
+ - network: "0064:ff9b:0:0:0:0:9810:6414"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:6414"
+ if: "xe0"
+ - network: "0064:ff9b:0:0:0:0:9810:2814"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:2814"
+ if: "xe1"
+
diff --git a/tests/unit/benchmark/contexts/nodes_sample_ovs.yaml b/tests/unit/benchmark/contexts/nodes_sample_ovs.yaml
new file mode 100644
index 000000000..b1da1ea9f
--- /dev/null
+++ b/tests/unit/benchmark/contexts/nodes_sample_ovs.yaml
@@ -0,0 +1,104 @@
+# Copyright (c) 2016 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nodes:
+-
+ name: trafficgen_1
+ role: TrafficGen
+ ip: 10.223.197.182
+ user: root
+ auth_type: password
+ password: intel123
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.0"
+ driver: ixgbe
+ dpdk_port_num: 0
+ local_ip: "152.16.100.20"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:68"
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.1"
+ driver: ixgbe
+ dpdk_port_num: 1
+ local_ip: "152.16.100.21"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:69"
+-
+ name: ovs
+ role: Ovsdpdk
+ ip: 10.223.197.222
+ user: root
+ auth_type: password
+ password: intel123
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
+-
+ name: vnf
+ role: vnf
+ ip: 10.223.197.155
+ user: root
+ auth_type: password
+ password: intel123
+ host: 10.223.197.140
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:04.0"
+ driver: virtio-pci
+ dpdk_port_num: 0
+ local_ip: "152.16.100.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:03"
+
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:05.0"
+ driver: virtio-pci
+ dpdk_port_num: 1
+ local_ip: "152.16.40.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:04"
+ routing_table:
+ - network: "152.16.100.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.100.20"
+ if: "xe0"
+ - network: "152.16.40.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.40.20"
+ if: "xe1"
+ nd_route_tbl:
+ - network: "0064:ff9b:0:0:0:0:9810:6414"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:6414"
+ if: "xe0"
+ - network: "0064:ff9b:0:0:0:0:9810:2814"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:2814"
+ if: "xe1"
diff --git a/tests/unit/benchmark/contexts/nodes_sample_ovsdpdk.yaml b/tests/unit/benchmark/contexts/nodes_sample_ovsdpdk.yaml
new file mode 100644
index 000000000..c02849a05
--- /dev/null
+++ b/tests/unit/benchmark/contexts/nodes_sample_ovsdpdk.yaml
@@ -0,0 +1,104 @@
+# Copyright (c) 2016 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nodes:
+-
+ name: trafficgen_1
+ role: TrafficGen
+ ip: 10.223.197.182
+ user: root
+ auth_type: password
+ password: intel123
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.0"
+ driver: ixgbe
+ dpdk_port_num: 0
+ local_ip: "152.16.100.20"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:68"
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.1"
+ driver: ixgbe
+ dpdk_port_num: 1
+ local_ip: "152.16.100.21"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:69"
+-
+ name: ovs
+ role: Ovsdpdk1
+ ip: 10.223.197.222
+ user: root
+ auth_type: password
+ password: intel123
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
+-
+ name: vnf
+ role: vnf
+ ip: 10.223.197.155
+ user: root
+ auth_type: password
+ password: intel123
+ host: 10.223.197.140
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:04.0"
+ driver: virtio-pci
+ dpdk_port_num: 0
+ local_ip: "152.16.100.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:03"
+
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:05.0"
+ driver: virtio-pci
+ dpdk_port_num: 1
+ local_ip: "152.16.40.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:04"
+ routing_table:
+ - network: "152.16.100.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.100.20"
+ if: "xe0"
+ - network: "152.16.40.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.40.20"
+ if: "xe1"
+ nd_route_tbl:
+ - network: "0064:ff9b:0:0:0:0:9810:6414"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:6414"
+ if: "xe0"
+ - network: "0064:ff9b:0:0:0:0:9810:2814"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:2814"
+ if: "xe1"
diff --git a/tests/unit/benchmark/contexts/ovs_sample_password.yaml b/tests/unit/benchmark/contexts/ovs_sample_password.yaml
new file mode 100644
index 000000000..b1da1ea9f
--- /dev/null
+++ b/tests/unit/benchmark/contexts/ovs_sample_password.yaml
@@ -0,0 +1,104 @@
+# Copyright (c) 2016 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+nodes:
+-
+ name: trafficgen_1
+ role: TrafficGen
+ ip: 10.223.197.182
+ user: root
+ auth_type: password
+ password: intel123
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.0"
+ driver: ixgbe
+ dpdk_port_num: 0
+ local_ip: "152.16.100.20"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:68"
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.1"
+ driver: ixgbe
+ dpdk_port_num: 1
+ local_ip: "152.16.100.21"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:69"
+-
+ name: ovs
+ role: Ovsdpdk
+ ip: 10.223.197.222
+ user: root
+ auth_type: password
+ password: intel123
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
+-
+ name: vnf
+ role: vnf
+ ip: 10.223.197.155
+ user: root
+ auth_type: password
+ password: intel123
+ host: 10.223.197.140
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:04.0"
+ driver: virtio-pci
+ dpdk_port_num: 0
+ local_ip: "152.16.100.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:03"
+
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:00:05.0"
+ driver: virtio-pci
+ dpdk_port_num: 1
+ local_ip: "152.16.40.19"
+ netmask: "255.255.255.0"
+ local_mac: "00:00:00:00:00:04"
+ routing_table:
+ - network: "152.16.100.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.100.20"
+ if: "xe0"
+ - network: "152.16.40.20"
+ netmask: "255.255.255.0"
+ gateway: "152.16.40.20"
+ if: "xe1"
+ nd_route_tbl:
+ - network: "0064:ff9b:0:0:0:0:9810:6414"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:6414"
+ if: "xe0"
+ - network: "0064:ff9b:0:0:0:0:9810:2814"
+ netmask: "112"
+ gateway: "0064:ff9b:0:0:0:0:9810:2814"
+ if: "xe1"
diff --git a/tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml b/tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml
new file mode 100644
index 000000000..896ec33bb
--- /dev/null
+++ b/tests/unit/benchmark/contexts/ovs_sample_ssh_key.yaml
@@ -0,0 +1,69 @@
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+---
+# Sample config file about the POD information, including the
+# name/IP/user/ssh key of Bare Metal and Controllers/Computes
+#
+# The options of this config file include:
+# name: the name of this node
+# role: node's role, support role: Master/Controller/Comupte/BareMetal
+# ip: the node's IP address
+# user: the username for login
+# key_filename:the path of the private key file for login
+
+nodes:
+-
+ name: trafficgen_1
+ role: TrafficGen
+ ip: 10.10.10.10
+ auth_type: ssh_key
+ user: root
+ ssh_port: 22
+ key_filename: /root/.ssh/id_rsa
+ interfaces:
+ xe0: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.0"
+ driver: ixgbe
+ dpdk_port_num: 0
+ local_ip: "152.16.100.20"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:68"
+ xe1: # logical name from topology.yaml and vnfd.yaml
+ vpci: "0000:03:00.1"
+ driver: ixgbe
+ dpdk_port_num: 1
+ local_ip: "152.16.100.21"
+ netmask: "255.255.255.0"
+ local_mac: "90:e2:ba:77:ce:69"
+-
+ name: ovs
+ role: Ovsdpdk
+ ip: 10.223.197.222
+ auth_type: ssh_key
+ user: root
+ ssh_port: 22
+ key_filename: /root/.ssh/id_rsa
+ vpath: "/usr/local/"
+ vports:
+ - dpdkvhostuser0
+ - dpdkvhostuser1
+ vports_mac:
+ - "00:00:00:00:00:03"
+ - "00:00:00:00:00:04"
+ phy_ports: # Physical ports to configure ovs
+ - "0000:06:00.0"
+ - "0000:06:00.1"
+ flow:
+ - ovs-ofctl add-flow br0 in_port=1,action=output:3
+ - ovs-ofctl add-flow br0 in_port=3,action=output:1
+ - ovs-ofctl add-flow br0 in_port=4,action=output:2
+ - ovs-ofctl add-flow br0 in_port=2,action=output:4
+ phy_driver: i40e # kernel driver
+ images: "/var/lib/libvirt/images/ubuntu1.img"
+
diff --git a/tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt b/tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt
new file mode 100644
index 000000000..f0eec86f6
--- /dev/null
+++ b/tests/unit/benchmark/contexts/ovs_sample_write_to_file.txt
@@ -0,0 +1 @@
+some content \ No newline at end of file
diff --git a/tests/unit/benchmark/contexts/test_ovsdpdk.py b/tests/unit/benchmark/contexts/test_ovsdpdk.py
new file mode 100644
index 000000000..125e475af
--- /dev/null
+++ b/tests/unit/benchmark/contexts/test_ovsdpdk.py
@@ -0,0 +1,328 @@
+# Copyright (c) 2016-2017 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import absolute_import
+import os
+import mock
+import unittest
+
+from yardstick.benchmark.contexts import ovsdpdk
+from yardstick.benchmark.contexts.ovsdpdk import Ovsdpdk
+
+NIC_INPUT = {
+ 'interface': {},
+ 'vports_mac': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'pci': ['0000:06:00.0', '0000:06:00.1'],
+ 'phy_driver': 'i40e'}
+DRIVER = "i40e"
+NIC_DETAILS = {
+ 'interface': {0: 'enp6s0f0', 1: 'enp6s0f1'},
+ 'vports_mac': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'pci': ['0000:06:00.0', '0000:06:00.1'],
+ 'phy_driver': 'i40e'}
+
+CORRECT_FILE_PATH = "/etc/yardstick/nodes/pod_ovs.yaml"
+WRONG_FILE_PATH = "/etc/yardstick/wrong.yaml"
+SAMPLE_FILE = "ovs_sample_write_to_file.txt"
+
+OVS = [{
+ 'auth_type': 'ssh_key',
+ 'name': 'ovs',
+ 'ssh_port': 22,
+ 'ip': '10.10.10.11',
+ 'key_filename': '/root/.ssh/id_rsa',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'vpath': '/usr/local/',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'flow': ['ovs-ofctl add-flow br0 in_port=1,action=output:3',
+ 'ovs-ofctl add-flow br0 in_port=3,action=output:1',
+ 'ovs-ofctl add-flow br0 in_port=4,action=output:2',
+ 'ovs-ofctl add-flow br0 in_port=2,action=output:4'],
+ 'phy_driver': 'i40e',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+OVS_PASSWORD = [{
+ 'auth_type': 'password',
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.10.10.11',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'flow': ['ovs-ofctl add-flow br0 in_port=1,action=output:3',
+ 'ovs-ofctl add-flow br0 in_port=3,action=output:1',
+ 'ovs-ofctl add-flow br0 in_port=4,action=output:2',
+ 'ovs-ofctl add-flow br0 in_port=2,action=output:4'],
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+#vfnic = "i40evf"
+PCIS = ['0000:06:00.0', '0000:06:00.1']
+
+
+class OvsdpdkTestCase(unittest.TestCase):
+
+ NODES_SAMPLE_SSH = "ovs_sample_ssh_key.yaml"
+ NODES_SAMPLE_PASSWORD = "ovs_sample_password.yaml"
+
+ def setUp(self):
+ self.test_context = ovsdpdk.Ovsdpdk()
+
+ def test_construct(self):
+ self.assertIsNone(self.test_context.name)
+ self.assertIsNone(self.test_context.file_path)
+ self.assertEqual(self.test_context.nodes, [])
+ self.assertEqual(self.test_context.ovs, [])
+ self.assertFalse(self.test_context.vm_deploy)
+ self.assertTrue(self.test_context.first_run)
+ self.assertEqual(self.test_context.user, "")
+ self.assertEqual(self.test_context.ssh_ip, "")
+ self.assertEqual(self.test_context.passwd, "")
+ self.assertEqual(self.test_context.ssh_port, "")
+ self.assertEqual(self.test_context.auth_type, "")
+
+ def test_init(self):
+ self.test_context.parse_pod_and_get_data = mock.Mock()
+ self.test_context.file_path = CORRECT_FILE_PATH
+ self.test_context.init()
+ self.assertIsNone(self.test_context.init())
+
+ def test_successful_init_with_ssh(self):
+ CORRECT_FILE_PATH = self._get_file_abspath(self.NODES_SAMPLE_SSH)
+ self.test_context.parse_pod_and_get_data(CORRECT_FILE_PATH)
+
+ def test_successful_init_with_password(self):
+ CORRECT_FILE_PATH = self._get_file_abspath(self.NODES_SAMPLE_PASSWORD)
+ self.test_context.parse_pod_and_get_data(CORRECT_FILE_PATH)
+
+ def test_unsuccessful_init(self):
+ self.assertRaises(
+ IOError,
+ lambda: self.test_context.parse_pod_and_get_data(WRONG_FILE_PATH))
+
+ def test_ssh_connection(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
+
+ @mock.patch('yardstick.network_services.utils.provision_tool', return_value="b")
+ 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())
+
+ @mock.patch('yardstick.network_services.utils.provision_tool', return_value="b")
+ def test_ssh_connection_ssh_key(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
+ ovs_obj.key_filename = '/root/.ssh/id_rsa'
+ self.assertIsNone(ovs_obj.ssh_remote_machine())
+
+ 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_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_setup_ovs(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.setup_ovs({"eth0 eth1"}))
+
+ def test_start_ovs_serverswitch(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.start_ovs_serverswitch())
+
+ def test_setup_ovs_bridge(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.setup_ovs_bridge())
+
+ 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_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"))
+ self.assertIsNone(ovs_obj.setup_ovs_context(
+ PCIS,
+ NIC_DETAILS,
+ DRIVER))
+
+ @mock.patch(
+ 'yardstick.benchmark.contexts.ovsdpdk',
+ return_value="Domain vm1 created from /tmp/vm_ovs.xml")
+ def test_is_vm_created(self, NIC_INPUT):
+ with mock.patch("yardstick.ssh.SSH") as ssh:
+ ssh_mock = mock.Mock(autospec=ssh.SSH)
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, {}, ""))
+ ssh_mock.put = \
+ mock.Mock(return_value=(0, {}, ""))
+ ssh.return_value = ssh_mock
+ mock_ovs = mock.Mock()
+ ret_create = mock.Mock()
+ pcis = NIC_DETAILS['pci']
+ driver = NIC_DETAILS['phy_driver']
+ self.assertIsNotNone(
+ mock_ovs.ovs_obj.setup_ovs_context(
+ pcis,
+ NIC_DETAILS,
+ driver))
+
+ 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_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 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_destroy_vm_successful(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=(0, "vm1"))
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, {}, ""))
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, {}, ""))
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "0 i40e"))
+ ssh_mock.execute = \
+ mock.Mock(return_value=(0, "0 i40e"))
+ self.assertIsNone(ovs_obj.destroy_vm())
+
+ 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_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_write_to_file(self):
+ ovs_obj = ovsdpdk.Ovsdpdk()
+ self.assertIsNone(ovs_obj.write_to_file(SAMPLE_FILE, "some content"))
+
+ def _get_file_abspath(self, filename):
+ curr_path = os.path.dirname(os.path.abspath(__file__))
+ file_path = os.path.join(curr_path, filename)
+ return file_path
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/unit/benchmark/contexts/test_standalone.py b/tests/unit/benchmark/contexts/test_standalone.py
index ee25bb33b..1fc740393 100644
--- a/tests/unit/benchmark/contexts/test_standalone.py
+++ b/tests/unit/benchmark/contexts/test_standalone.py
@@ -21,81 +21,138 @@ from __future__ import absolute_import
import os
import unittest
import mock
+
from yardstick.benchmark.contexts import standalone
from yardstick.benchmark.contexts import sriov
+from yardstick.benchmark.contexts import ovsdpdk
MOCKS = {
'yardstick.benchmark.contexts': mock.MagicMock(),
'yardstick.benchmark.contexts.sriov': mock.MagicMock(),
+ 'yardstick.benchmark.contexts.ovsdpdk': mock.MagicMock(),
'yardstick.benchmark.contexts.standalone': mock.MagicMock(),
}
+@mock.patch('yardstick.benchmark.contexts.ovsdpdk.time')
+@mock.patch('yardstick.benchmark.contexts.standalone.time')
+@mock.patch('yardstick.benchmark.contexts.sriov.time')
class StandaloneContextTestCase(unittest.TestCase):
-
NODES_SAMPLE = "nodes_sample_new.yaml"
+ NODES_SAMPLE_SRIOV = "nodes_sample_new_sriov.yaml"
NODES_DUPLICATE_SAMPLE = "nodes_duplicate_sample_new.yaml"
+ NODES_SAMPLE_OVSDPDK = "nodes_sample_ovs.yaml"
+ NODES_SAMPLE_OVSDPDK_ROLE = "nodes_sample_ovsdpdk.yaml"
+ NODES_DUPLICATE_OVSDPDK = "nodes_duplicate_sample_ovs.yaml"
+
def setUp(self):
self.test_context = standalone.StandaloneContext()
- def test_construct(self):
+ def test_construct(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
self.assertIsNone(self.test_context.name)
self.assertIsNone(self.test_context.file_path)
self.assertEqual(self.test_context.nodes, [])
self.assertEqual(self.test_context.nfvi_node, [])
- def test_unsuccessful_init(self):
+ def test_unsuccessful_init(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
attrs = {
'name': 'foo',
'file': self._get_file_abspath("error_file")
}
self.assertRaises(IOError, self.test_context.init, attrs)
- def test_successful_init(self):
- attrs = {
+ def test_successful_init_sriov(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs_sriov = {
'name': 'sriov',
'file': self._get_file_abspath(self.NODES_SAMPLE)
}
-
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
- 'password': 'password',
+ 'password': 'intel123',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
self.test_context.get_nfvi_obj = mock.Mock()
- self.test_context.init(attrs)
+ self.test_context.init(attrs_sriov)
self.assertEqual(self.test_context.name, "sriov")
- self.assertEqual(len(self.test_context.nodes), 3)
+ self.assertEqual(len(self.test_context.nodes), 2)
self.assertEqual(len(self.test_context.nfvi_node), 2)
self.assertEqual(self.test_context.nfvi_node[0]["name"], "sriov")
- def test__get_server_with_dic_attr_name(self):
- attrs = {
+ def test_successful_init_ovs(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
+ attrs_ovs = {
+ 'name': 'ovs',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.get_nfvi_obj = mock.Mock()
+ self.test_context.init(attrs_ovs)
+ self.assertEqual(self.test_context.name, "ovs")
+ self.assertEqual(len(self.test_context.nodes), 2)
+ self.assertEqual(len(self.test_context.nfvi_node), 2)
+ self.assertEqual(self.test_context.nfvi_node[0]["name"], "ovs")
+
+ def test__get_server_with_dic_attr_name_sriov(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs_sriov = {
'name': 'foo',
'file': self._get_file_abspath(self.NODES_SAMPLE)
}
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
- 'password': 'password',
+ 'password': 'intel123',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
- self.test_context.init(attrs)
+ self.test_context.init(attrs_sriov)
attr_name = {'name': 'foo.bar'}
result = self.test_context._get_server(attr_name)
self.assertEqual(result, None)
- def test__get_server_not_found(self):
+ def test__get_server_with_dic_attr_name_ovs(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs_ovs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.init(attrs_ovs)
+ attr_name = {'name': 'foo.bar'}
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result, None)
+
+ def test__get_server_not_found_sriov(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
attrs = {
'name': 'foo',
'file': self._get_file_abspath(self.NODES_SAMPLE)
@@ -103,7 +160,7 @@ class StandaloneContextTestCase(unittest.TestCase):
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
@@ -115,7 +172,32 @@ class StandaloneContextTestCase(unittest.TestCase):
result = self.test_context._get_server(attr_name)
self.assertEqual(result, None)
- def test__get_server_duplicate(self):
+ def test__get_server_not_found_ovs(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.init(attrs)
+ attr_name = 'bar.foo'
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result, None)
+
+
+
+ def test__get_server_duplicate_sriov(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
attrs = {
'name': 'foo',
'file': self._get_file_abspath(self.NODES_DUPLICATE_SAMPLE)
@@ -123,62 +205,134 @@ class StandaloneContextTestCase(unittest.TestCase):
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
'password': 'password',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.get_nfvi_obj = mock.Mock(return_value="sriov")
self.test_context.init(attrs)
attr_name = 'sriov.foo'
+ # self.test_context.name = "sriov"
+ self.assertRaises(ValueError, self.test_context._get_server, attr_name)
+
+ def test__get_server_duplicate_ovs(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_DUPLICATE_OVSDPDK)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.get_nfvi_obj = mock.Mock(return_value="OvsDpdk")
+ self.test_context.init(attrs)
+
+ attr_name = 'ovs.foo'
self.assertRaises(
ValueError,
self.test_context._get_server,
attr_name)
-
- def test__get_server_found(self):
+ def test__get_server_found_sriov(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
attrs = {
- 'name': 'sriov',
- 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_SRIOV)
}
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
- 'password': 'password',
+ 'password': 'intel123',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.get_nfvi_obj = mock.Mock(return_value="OvsDpdk")
self.test_context.init(attrs)
- attr_name = 'sriov.sriov'
+ attr_name = 'sriov.foo'
result = self.test_context._get_server(attr_name)
self.assertEqual(result['ip'], '10.123.123.122')
- self.assertEqual(result['name'], 'sriov.sriov')
+ self.assertEqual(result['name'], 'sriov.foo')
self.assertEqual(result['user'], 'root')
- def test_deploy(self):
+ def test__get_server_found_ovs(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
attrs = {
'name': 'foo',
- 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK_ROLE)
}
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.get_nfvi_obj = mock.Mock(return_value="OvsDpdk")
+ self.test_context.init(attrs)
+ attr_name = 'ovs.foo'
+ result = self.test_context._get_server(attr_name)
+ self.assertEqual(result['ip'], '10.223.197.222')
+ self.assertEqual(result['name'], 'ovs.foo')
+ self.assertEqual(result['user'], 'root')
+ def test__deploy_unsuccessful(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
+ self.test_context.vm_deploy = False
+
+ def test__deploy_sriov_firsttime(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
- 'password': 'password',
+ 'password': 'intel123',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ MYSRIOV = [{
+ 'name': 'sriov',
+ 'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'ip': '10.223.197.140',
+ 'role': 'Sriov',
+ 'user': 'root',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.vm_deploy = True
+
self.test_context.get_nfvi_obj = mock.MagicMock()
self.test_context.init(attrs)
+ self.test_context.nfvi_obj.sriov = MYSRIOV
self.test_context.nfvi_obj.ssh_remote_machine = mock.Mock()
self.test_context.nfvi_obj.first_run = True
+ self.test_context.nfvi_obj.install_req_libs()
self.test_context.nfvi_obj.get_nic_details = mock.Mock()
PORTS = ['0000:06:00.0', '0000:06:00.1']
NIC_DETAILS = {
@@ -194,27 +348,228 @@ class StandaloneContextTestCase(unittest.TestCase):
print("{0}".format(result))
self.assertIsNone(self.test_context.deploy())
- def test_undeploy(self):
+ def test__deploy_sriov_notfirsttime(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
attrs = {
'name': 'foo',
'file': self._get_file_abspath(self.NODES_SAMPLE)
}
+
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ MYSRIOV = [{
+ 'name': 'sriov',
+ 'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'ip': '10.223.197.140',
+ 'role': 'Sriov',
+ 'user': 'root',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.vm_deploy = True
+ self.test_context.get_nfvi_obj = mock.MagicMock()
+ self.test_context.init(attrs)
+ self.test_context.nfvi_obj.sriov = MYSRIOV
+ self.test_context.nfvi_obj.ssh_remote_machine = mock.Mock()
+ self.test_context.nfvi_obj.first_run = False
+ self.test_context.nfvi_obj.get_nic_details = mock.Mock()
+ PORTS = ['0000:06:00.0', '0000:06:00.1']
+ NIC_DETAILS = {
+ 'interface': {0: 'enp6s0f0', 1: 'enp6s0f1'},
+ 'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'pci': ['0000:06:00.0', '0000:06:00.1'],
+ 'phy_driver': 'i40e'}
+ DRIVER = 'i40e'
+ result = self.test_context.nfvi_obj.setup_sriov_context(
+ PORTS,
+ NIC_DETAILS,
+ DRIVER)
+ print("{0}".format(result))
+ self.assertIsNone(self.test_context.deploy())
+
+ def test__deploy_ovs_firsttime(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ MYOVS = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
'password': 'password',
+ 'flow': ['ovs-ofctl add-flow br0 in_port=1,action=output:3',
+ 'ovs-ofctl add-flow br0 in_port=3,action=output:1'
+ 'ovs-ofctl add-flow br0 in_port=4,action=output:2'
+ 'ovs-ofctl add-flow br0 in_port=2,action=output:4'],
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.vm_deploy = True
+ self.test_context.get_nfvi_obj = mock.MagicMock()
+ self.test_context.init(attrs)
+ self.test_context.ovs = MYOVS
+ self.test_context.nfvi_obj.ssh_remote_machine = mock.Mock()
+ self.test_context.nfvi_obj.first_run = True
+ self.test_context.nfvi_obj.install_req_libs()
+ self.test_context.nfvi_obj.get_nic_details = mock.Mock()
+ PORTS = ['0000:06:00.0', '0000:06:00.1']
+ NIC_DETAILS = {
+ 'interface': {0: 'enp6s0f0', 1: 'enp6s0f1'},
+ 'vports_mac': ['00:00:00:00:00:05', '00:00:00:00:00:06'],
+ 'pci': ['0000:06:00.0', '0000:06:00.1'],
+ 'phy_driver': 'i40e'}
+ DRIVER = 'i40e'
+
+ self.test_context.nfvi_obj.setup_ovs = mock.Mock()
+ self.test_context.nfvi_obj.start_ovs_serverswitch = mock.Mock()
+ self.test_context.nfvi_obj.setup_ovs_bridge = mock.Mock()
+ self.test_context.nfvi_obj.add_oflows = mock.Mock()
+
+ # self.test_context.nfvi_obj.setup_ovs(PORTS)
+ # self.test_context.nfvi_obj.start_ovs_serverswitch()
+ # self.test_context.nfvi_obj.setup_ovs_bridge()
+ # self.test_context.nfvi_obj.add_oflows()
+
+ result = self.test_context.nfvi_obj.setup_ovs_context(
+ PORTS,
+ NIC_DETAILS,
+ DRIVER)
+ print("{0}".format(result))
+ self.assertIsNone(self.test_context.deploy())
+
+ def test__deploy_ovs_notfirsttime(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ MYOVS = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'flow': ['ovs-ofctl add-flow br0 in_port=1,action=output:3',
+ 'ovs-ofctl add-flow br0 in_port=3,action=output:1'
+ 'ovs-ofctl add-flow br0 in_port=4,action=output:2'
+ 'ovs-ofctl add-flow br0 in_port=2,action=output:4'],
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
+ self.test_context.vm_deploy = True
+ self.test_context.get_nfvi_obj = mock.MagicMock()
+ self.test_context.init(attrs)
+ self.test_context.ovs = MYOVS
+ self.test_context.nfvi_obj.ssh_remote_machine = mock.Mock()
+ self.test_context.nfvi_obj.first_run = False
+ self.test_context.nfvi_obj.get_nic_details = mock.Mock()
+ PORTS = ['0000:06:00.0', '0000:06:00.1']
+ NIC_DETAILS = {
+ 'interface': {0: 'enp6s0f0', 1: 'enp6s0f1'},
+ 'vports_mac': ['00:00:00:00:00:05', '00:00:00:00:00:06'],
+ 'pci': ['0000:06:00.0', '0000:06:00.1'],
+ 'phy_driver': 'i40e'}
+ DRIVER = 'i40e'
+
+ self.test_context.nfvi_obj.setup_ovs(PORTS)
+ self.test_context.nfvi_obj.start_ovs_serverswitch()
+ self.test_context.nfvi_obj.setup_ovs_bridge()
+ self.test_context.nfvi_obj.add_oflows()
+
+ result = self.test_context.nfvi_obj.setup_ovs_context(
+ PORTS,
+ NIC_DETAILS,
+ DRIVER)
+ print("{0}".format(result))
+ self.assertIsNone(self.test_context.deploy())
+
+ def test_undeploy_sriov(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE)
+ }
+ self.test_context.nfvi_node = [{
+ 'name': 'sriov',
+ 'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
+ 'ip': '10.223.197.140',
+ 'role': 'Sriov',
+ 'user': 'root',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'intel123',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.get_nfvi_obj = mock.MagicMock()
+ self.test_context.init(attrs)
+ self.test_context.nfvi_obj.destroy_vm = mock.Mock()
+ self.assertIsNone(self.test_context.undeploy())
+
+ def test_undeploy_ovs(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
+ attrs = {
+ 'name': 'foo',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+
self.test_context.get_nfvi_obj = mock.MagicMock()
self.test_context.init(attrs)
self.test_context.nfvi_obj.destroy_vm = mock.Mock()
self.assertIsNone(self.test_context.undeploy())
- def test_get_nfvi_obj(self):
+ def test_get_nfvi_obj_sriov(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
with mock.patch('yardstick.benchmark.contexts.sriov'):
attrs = {
'name': 'sriov',
@@ -226,12 +581,12 @@ class StandaloneContextTestCase(unittest.TestCase):
self.test_context.nfvi_node = [{
'name': 'sriov',
'vf_macs': ['00:00:00:71:7d:25', '00:00:00:71:7d:26'],
- 'ip': '10.123.123.122',
+ 'ip': '10.223.197.140',
'role': 'Sriov',
'user': 'root',
'images': '/var/lib/libvirt/images/ubuntu1.img',
'phy_driver': 'i40e',
- 'password': 'password',
+ 'password': 'intel123',
'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
self.test_context.get_nfvi_obj = mock.MagicMock()
self.test_context.init(attrs)
@@ -239,11 +594,39 @@ class StandaloneContextTestCase(unittest.TestCase):
return_value=sriov.Sriov)
self.assertIsNotNone(self.test_context.get_nfvi_obj())
- def test_get_context_impl_correct_obj(self):
+ def test_get_nfvi_obj_ovs(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
+ with mock.patch('yardstick.benchmark.contexts.ovsdpdk'):
+ attrs = {
+ 'name': 'ovs',
+ 'file': self._get_file_abspath(self.NODES_SAMPLE_OVSDPDK)
+ }
+ self.test_context.init(attrs)
+ self.test_context.nfvi_obj.file_path = self._get_file_abspath(
+ self.NODES_SAMPLE)
+ self.test_context.nfvi_node = [{
+ 'name': 'ovs',
+ 'vports_mac': ['00:00:00:00:00:03', '00:00:00:00:00:04'],
+ 'ip': '10.223.197.140',
+ 'role': 'Ovsdpdk',
+ 'user': 'root',
+ 'vpath': '/usr/local/',
+ 'images': '/var/lib/libvirt/images/ubuntu1.img',
+ 'phy_driver': 'i40e',
+ 'password': 'password',
+ 'phy_ports': ['0000:06:00.0', '0000:06:00.1']}]
+ self.test_context.get_nfvi_obj = mock.MagicMock()
+ self.test_context.init(attrs)
+ self.test_context.get_context_impl = mock.Mock(
+ return_value=ovsdpdk.Ovsdpdk)
+ self.assertIsNotNone(self.test_context.get_nfvi_obj())
+
+ def test_get_context_impl_correct_obj(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
with mock.patch.dict("sys.modules", MOCKS):
self.assertIsNotNone(self.test_context.get_context_impl('Sriov'))
- def test_get_context_impl_wrong_obj(self):
+ def test_get_context_impl_wrong_obj(self, mock_sriov_time, mock_standlalone_time,
+ mock_ovsdpdk_time):
with mock.patch.dict("sys.modules", MOCKS):
self.assertRaises(
ValueError,
@@ -254,7 +637,7 @@ class StandaloneContextTestCase(unittest.TestCase):
file_path = os.path.join(curr_path, filename)
return file_path
- def test__get_network(self):
+ def test__get_network(self, mock_sriov_time, mock_standlalone_time, mock_ovsdpdk_time):
network1 = {
'name': 'net_1',
'vld_id': 'vld111',
@@ -300,3 +683,4 @@ class StandaloneContextTestCase(unittest.TestCase):
self.assertDictEqual(result, expected)
if __name__ == '__main__':
unittest.main()
+