diff options
27 files changed, 439 insertions, 160 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile index 71ce6b584..eeeeabca9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -26,7 +26,7 @@ ENV YARDSTICK_REPO_DIR="${REPOS_DIR}/yardstick/" \ RUN apt-get update && apt-get install -y git python python-setuptools python-pip iputils-ping && apt-get -y autoremove && apt-get clean RUN easy_install -U setuptools==30.0.0 -RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 python-openstackclient==3.12.0 python-heatclient==1.11.0 ansible==2.5.5 +RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 openstacksdk==0.9.17 python-openstackclient==3.12.1 python-heatclient==1.11.1 ansible==2.4.2 RUN mkdir -p ${REPOS_DIR} diff --git a/docker/Dockerfile.aarch64.patch b/docker/Dockerfile.aarch64.patch index 2e2808ed1..a6909ee4b 100644 --- a/docker/Dockerfile.aarch64.patch +++ b/docker/Dockerfile.aarch64.patch @@ -31,7 +31,7 @@ index 71ce6b58..fce7c116 100644 +RUN apt-get update && apt-get install -y git python python-setuptools python-pip iputils-ping && apt-get -y autoremove && \ + apt-get install -y libssl-dev && apt-get -y install libffi-dev && apt-get clean RUN easy_install -U setuptools==30.0.0 - RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 python-openstackclient==3.12.0 python-heatclient==1.11.0 ansible==2.5.5 + RUN pip install appdirs==1.4.0 pyopenssl==17.5.0 openstacksdk==0.9.17 python-openstackclient==3.12.1 python-heatclient==1.11.1 ansible==2.4.2 @@ -40,7 +41,8 @@ RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/yardstick ${Y RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${RELENG_REPO_DIR} diff --git a/docs/testing/user/userguide/13-nsb-installation.rst b/docs/testing/user/userguide/13-nsb-installation.rst index 3e0ed0bfb..fb68fbf21 100644 --- a/docs/testing/user/userguide/13-nsb-installation.rst +++ b/docs/testing/user/userguide/13-nsb-installation.rst @@ -118,7 +118,7 @@ Ansible: .. code-block:: ini - cat ./ansible/yardstick-install-inventory.ini + cat ./ansible/install-inventory.ini [jumphost] localhost ansible_connection=local @@ -138,7 +138,7 @@ Ansible: .. note:: SSH access without password needs to be configured for all your nodes defined in - ``yardstick-install-inventory.ini`` file. + ``install-inventory.ini`` file. If you want to use password authentication you need to install sshpass .. code-block:: console @@ -352,18 +352,53 @@ SR-IOV SR-IOV Pre-requisites ^^^^^^^^^^^^^^^^^^^^^ -On Host: - a) Create a bridge for VM to connect to external network +On Host, where VM is created: + a) Create and configure a bridge named ``br-int`` for VM to connect to external network. + Currently this can be done using VXLAN tunnel. + + Execute the following on host, where VM is created: .. code-block:: console + ip link add type vxlan remote <Jumphost IP> local <DUT IP> id <ID: 10> dstport 4789 brctl addbr br-int - brctl addif br-int <interface_name> #This interface is connected to internet + brctl addif br-int vxlan0 + ip link set dev vxlan0 up + ip addr add <IP#1, like: 172.20.2.1/24> dev br-int + ip link set dev br-int up + + .. note:: May be needed to add extra rules to iptable to forward traffic. + + .. code-block:: console + + iptables -A FORWARD -i br-int -s <network ip address>/<netmask> -j ACCEPT + iptables -A FORWARD -o br-int -d <network ip address>/<netmask> -j ACCEPT + + Execute the following on a jump host: + + .. code-block:: console + + ip link add type vxlan remote <DUT IP> local <Jumphost IP> id <ID: 10> dstport 4789 + ip addr add <IP#2, like: 172.20.2.2/24> dev vxlan0 + ip link set dev vxlan0 up + + .. note:: Host and jump host are different baremetal servers. + + b) Modify test case management CIDR. + IP addresses IP#1, IP#2 and CIDR must be in the same network. + + .. code-block:: YAML + + servers: + vnf: + network_ports: + mgmt: + cidr: '1.1.1.7/24' - b) Build guest image for VNF to run. + c) Build guest image for VNF to run. Most of the sample test cases in Yardstick are using a guest image called - ``yardstick-image`` which deviates from an Ubuntu Cloud Server image - Yardstick has a tool for building this custom image with samplevnf. + ``yardstick-nsb-image`` which deviates from an Ubuntu Cloud Server image + Yardstick has a tool for building this custom image with SampleVNF. It is necessary to have ``sudo`` rights to use this tool. Also you may need to install several additional packages to use this tool, by @@ -548,18 +583,53 @@ OVS-DPDK OVS-DPDK Pre-requisites ^^^^^^^^^^^^^^^^^^^^^^^ -On Host: - a) Create a bridge for VM to connect to external network +On Host, where VM is created: + a) Create and configure a bridge named ``br-int`` for VM to connect to external network. + Currently this can be done using VXLAN tunnel. + + Execute the following on host, where VM is created: .. code-block:: console + ip link add type vxlan remote <Jumphost IP> local <DUT IP> id <ID: 10> dstport 4789 brctl addbr br-int - brctl addif br-int <interface_name> #This interface is connected to internet + brctl addif br-int vxlan0 + ip link set dev vxlan0 up + ip addr add <IP#1, like: 172.20.2.1/24> dev br-int + ip link set dev br-int up + + .. note:: May be needed to add extra rules to iptable to forward traffic. + + .. code-block:: console + + iptables -A FORWARD -i br-int -s <network ip address>/<netmask> -j ACCEPT + iptables -A FORWARD -o br-int -d <network ip address>/<netmask> -j ACCEPT + + Execute the following on a jump host: + + .. code-block:: console + + ip link add type vxlan remote <DUT IP> local <Jumphost IP> id <ID: 10> dstport 4789 + ip addr add <IP#2, like: 172.20.2.2/24> dev vxlan0 + ip link set dev vxlan0 up + + .. note:: Host and jump host are different baremetal servers. + + b) Modify test case management CIDR. + IP addresses IP#1, IP#2 and CIDR must be in the same network. + + .. code-block:: YAML + + servers: + vnf: + network_ports: + mgmt: + cidr: '1.1.1.7/24' - b) Build guest image for VNF to run. + c) Build guest image for VNF to run. Most of the sample test cases in Yardstick are using a guest image called - ``yardstick-image`` which deviates from an Ubuntu Cloud Server image - Yardstick has a tool for building this custom image with samplevnf. + ``yardstick-nsb-image`` which deviates from an Ubuntu Cloud Server image + Yardstick has a tool for building this custom image with SampleVNF. It is necessary to have ``sudo`` rights to use this tool. Also you may need to install several additional packages to use this tool, by @@ -880,7 +950,7 @@ Install dependencies needed for the DevStack Setup SR-IOV ports on the host: -.. note:: The ``enp24s0f0``, ``enp24s0f0`` are physical function (PF) interfaces +.. note:: The ``enp24s0f0``, ``enp24s0f1`` are physical function (PF) interfaces on a host and ``enp24s0f3`` is a public interface used in OpenStack, so the interface names should be changed according to the HW environment used for testing. diff --git a/samples/ping-security-group.yaml b/samples/ping-security-group.yaml new file mode 100644 index 000000000..1545ee1cf --- /dev/null +++ b/samples/ping-security-group.yaml @@ -0,0 +1,74 @@ +############################################################################## +# Copyright (c) 2018 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 ping test case using custom security group +# measure network latency using ping + +schema: "yardstick:task:0.1" + +{% set provider = provider or none %} +{% set physical_network = physical_network or 'physnet1' %} +{% set segmentation_id = segmentation_id or none %} +scenarios: +- + type: Ping + options: + packetsize: 200 + host: athena.demo + target: ares.demo + + runner: + type: Duration + duration: 60 + interval: 1 + + sla: + max_rtt: 10 + action: monitor + +context: + name: demo + image: yardstick-image + flavor: yardstick-flavor + user: ubuntu + security_group: + rules: + - remote_ip_prefix: "0.0.0.0/0" + protocol: "tcp" + port_range_min: 1 + port_range_max: 65535 + - remote_ip_prefix: "0.0.0.0/0" + protocol: "udp" + port_range_min: 1 + port_range_max: 65535 + - remote_ip_prefix: "0.0.0.0/0" + protocol: "icmp" + + placement_groups: + pgrp1: + policy: "availability" + + servers: + athena: + floating_ip: true + placement: "pgrp1" + ares: + placement: "pgrp1" + + + networks: + test: + cidr: '10.0.1.0/24' + {% if provider == "vlan" %} + provider: {{provider}} + physical_network: {{physical_network}} + {% if segmentation_id %} + segmentation_id: {{segmentation_id}} + {% endif %} + {% endif %} diff --git a/samples/ping_bottlenecks.yaml b/samples/ping_bottlenecks.yaml index 096d70e67..6a586cb90 100644 --- a/samples/ping_bottlenecks.yaml +++ b/samples/ping_bottlenecks.yaml @@ -49,6 +49,18 @@ contexts: hw:mem_page_size: "large" {% endif %} user: ubuntu + security_group: + rules: + - remote_ip_prefix: "0.0.0.0/0" + protocol: "tcp" + port_range_min: 1 + port_range_max: 65535 + - remote_ip_prefix: "0.0.0.0/0" + protocol: "udp" + port_range_min: 1 + port_range_max: 65535 + - remote_ip_prefix: "0.0.0.0/0" + protocol: "icmp" placement_groups: pgrp1: diff --git a/samples/vnf_samples/nsut/acl/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/acl/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 00bd186ee..e62425ad7 100644 --- a/samples/vnf_samples/nsut/acl/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/acl/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: acl-tg-topology.yaml nodes: - tg__0: tg__0.yardstick + tg__0: trafficgen_1.yardstick vnf__0: vnf__0.yardstick options: framesize: @@ -42,10 +42,10 @@ scenarios: contexts: - name: yardstick type: Node - file: etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneOvsDpdk name: yardstick - file: etc/yardstick/nodes/standalone/host_ovs.yaml + file: /etc/yardstick/nodes/standalone/host_ovs.yaml vm_deploy: True ovs_properties: version: @@ -62,7 +62,7 @@ contexts: flavor: images: "/var/lib/libvirt/images/yardstick-nsb-image.img" - ram: 4096 + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 6 diff --git a/samples/vnf_samples/nsut/acl/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/acl/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 8b3241620..77df5b18c 100644 --- a/samples/vnf_samples/nsut/acl/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/acl/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: acl-tg-topology.yaml nodes: - tg__0: tg__0.yardstick - vnf__0: vnf.yardstick + tg__0: trafficgen_1.yardstick + vnf__0: vnf__0.yardstick options: framesize: uplink: {64B: 100} @@ -42,14 +42,14 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneSriov file: /etc/yardstick/nodes/standalone/host_sriov.yaml name: yardstick vm_deploy: True flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 6 @@ -57,7 +57,7 @@ contexts: user: "" password: "" servers: - vnf: + vnf__0: network_ports: mgmt: cidr: '1.1.1.61/24' diff --git a/samples/vnf_samples/nsut/cgnapt/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml b/samples/vnf_samples/nsut/cgnapt/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml index 52becd3c6..170b2c539 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput_cgnapt.yaml topology: cgnapt-vnf-topology.yaml nodes: - tg__0: tg__0.yardstick + tg__0: trafficgen_1.yardstick vnf__0: vnf__0.yardstick options: framesize: @@ -42,7 +42,7 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneOvsDpdk name: yardstick file: /etc/yardstick/nodes/standalone/pod_ovs.yaml @@ -59,8 +59,8 @@ contexts: vpath: "/usr/local" flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 7 diff --git a/samples/vnf_samples/nsut/cgnapt/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml b/samples/vnf_samples/nsut/cgnapt/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml index ec517bbef..523cb2eb3 100644 --- a/samples/vnf_samples/nsut/cgnapt/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml +++ b/samples/vnf_samples/nsut/cgnapt/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput_cgnapt.yaml topology: cgnapt-vnf-topology.yaml nodes: - tg__0: tg__0.yardstick - vnf__0: vnf.yardstick + tg__0: trafficgen_1.yardstick + vnf__0: vnf__0.yardstick options: framesize: uplink: {64B: 100} @@ -42,14 +42,14 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneSriov file: /etc/yardstick/nodes/standalone/host_sriov.yaml name: yardstick vm_deploy: True flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 7 @@ -57,7 +57,7 @@ contexts: user: "" password: "" servers: - vnf: + vnf__0: network_ports: mgmt: cidr: '1.1.1.61/24' diff --git a/samples/vnf_samples/nsut/udp_replay/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml b/samples/vnf_samples/nsut/udp_replay/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml index bea9c8261..86c8f6ea8 100644 --- a/samples/vnf_samples/nsut/udp_replay/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml +++ b/samples/vnf_samples/nsut/udp_replay/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: udp_replay-vnf-topology.yaml nodes: - tg__0: tg__0.yardstick + tg__0: trafficgen_1.yardstick vnf__0: vnf__0.yardstick options: framesize: @@ -41,7 +41,7 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneOvsDpdk name: yardstick file: /etc/yardstick/nodes/standalone/pod_ovs.yaml @@ -58,8 +58,8 @@ contexts: vpath: "/usr/local" flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 7 diff --git a/samples/vnf_samples/nsut/udp_replay/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml b/samples/vnf_samples/nsut/udp_replay/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml index 0867d6b51..f9bc8119e 100644 --- a/samples/vnf_samples/nsut/udp_replay/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml +++ b/samples/vnf_samples/nsut/udp_replay/tc_sriov_rfc2544_ipv4_1rule_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: udp_replay-vnf-topology.yaml nodes: - tg__0: tg__0.yardstick - vnf__0: vnf.yardstick + tg__0: trafficgen_1.yardstick + vnf__0: vnf__0.yardstick options: framesize: uplink: {64B: 100} @@ -41,14 +41,14 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneSriov file: /etc/yardstick/nodes/standalone/host_sriov.yaml name: yardstick vm_deploy: True flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 7 @@ -56,7 +56,7 @@ contexts: user: "" password: "" servers: - vnf: + vnf__0: network_ports: mgmt: cidr: '1.1.1.61/24' diff --git a/samples/vnf_samples/nsut/vfw/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/vfw/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 6b9ccb111..4aeadc6db 100644 --- a/samples/vnf_samples/nsut/vfw/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: vfw-tg-topology.yaml nodes: - tg__0: tg__0.yardstick + tg__0: trafficgen_1.yardstick vnf__0: vnf__0.yardstick options: framesize: @@ -42,7 +42,7 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneOvsDpdk name: yardstick file: /etc/yardstick/nodes/standalone/pod_ovs.yaml @@ -59,8 +59,8 @@ contexts: vpath: "/usr/local" flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 6 diff --git a/samples/vnf_samples/nsut/vfw/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml b/samples/vnf_samples/nsut/vfw/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml index 0f1560183..221ead4f9 100644 --- a/samples/vnf_samples/nsut/vfw/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml +++ b/samples/vnf_samples/nsut/vfw/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,8 +19,8 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput.yaml topology: vfw-tg-topology.yaml nodes: - tg__0: tg__0.yardstick - vnf__0: vnf.yardstick + tg__0: trafficgen_1.yardstick + vnf__0: vnf__0.yardstick options: framesize: uplink: {64B: 100} @@ -42,14 +42,14 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneSriov file: /etc/yardstick/nodes/standalone/host_sriov.yaml name: yardstick vm_deploy: True flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 4096 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 16384 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 6 @@ -57,7 +57,7 @@ contexts: user: "" password: "" servers: - vnf: + vnf__0: network_ports: mgmt: cidr: '1.1.1.61/24' diff --git a/samples/vnf_samples/nsut/vpe/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml b/samples/vnf_samples/nsut/vpe/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml index 2382e0292..ce239808e 100644 --- a/samples/vnf_samples/nsut/vpe/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml +++ b/samples/vnf_samples/nsut/vpe/tc_ovs_rfc2544_ipv4_1rule_64B_trex.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2017 Intel Corporation +# Copyright (c) 2016-2018 Intel Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ scenarios: traffic_profile: ../../traffic_profiles/ipv4_throughput_vpe.yaml topology: vpe_vnf_topology.yaml nodes: - tg__0: tg__0.yardstick + tg__0: trafficgen_1.yardstick vnf__0: vnf__0.yardstick options: framesize: @@ -42,7 +42,7 @@ scenarios: contexts: - name: yardstick type: Node - file: /etc/yardstick/nodes/standalone/pod_trex.yaml + file: /etc/yardstick/nodes/standalone/trex_bm.yaml - type: StandaloneOvsDpdk name: yardstick file: /etc/yardstick/nodes/standalone/pod_ovs.yaml @@ -59,8 +59,8 @@ contexts: vpath: "/usr/local" flavor: - images: "/var/lib/libvirt/images/ubuntu.qcow2" - ram: 16364 + images: "/var/lib/libvirt/images/yardstick-nsb-image.img" + ram: 20480 extra_specs: hw:cpu_sockets: 1 hw:cpu_cores: 7 diff --git a/yardstick/benchmark/contexts/heat.py b/yardstick/benchmark/contexts/heat.py index f118ffc32..c3c5451bd 100644 --- a/yardstick/benchmark/contexts/heat.py +++ b/yardstick/benchmark/contexts/heat.py @@ -59,6 +59,7 @@ class HeatContext(Context): self.server_groups = [] self.keypair_name = None self.secgroup_name = None + self.security_group = None self._server_map = {} self.attrs = {} self._image = None @@ -118,8 +119,11 @@ class HeatContext(Context): return self.keypair_name = h_join(self.name, "key") + self.secgroup_name = h_join(self.name, "secgroup") + self.security_group = attrs.get("security_group") + self._image = attrs.get("image") self._flavor = attrs.get("flavor") @@ -185,7 +189,7 @@ class HeatContext(Context): self.flavors.add(flavor) template.add_keypair(self.keypair_name, self.name) - template.add_security_group(self.secgroup_name) + template.add_security_group(self.secgroup_name, self.security_group) for network in self.networks.values(): # Using existing network diff --git a/yardstick/benchmark/contexts/standalone/model.py b/yardstick/benchmark/contexts/standalone/model.py index 962cb48e2..fa78fc1eb 100644 --- a/yardstick/benchmark/contexts/standalone/model.py +++ b/yardstick/benchmark/contexts/standalone/model.py @@ -100,6 +100,19 @@ users: EOF """ +NETWORK_DATA_TEMPLATE = """ +cat > {network_file} <<EOF +#cloud-config +version: 2 +ethernets: + ens3: + match: + mac_address: {mac_address} + addresses: + - {ip_address} +EOF +""" + WAIT_FOR_BOOT = 30 @@ -370,7 +383,7 @@ class Libvirt(object): return ET.tostring(root) @staticmethod - def gen_cdrom_image(connection, file_path, vm_name, vm_user, key_filename): + def gen_cdrom_image(connection, file_path, vm_name, vm_user, key_filename, mac, ip): """Generate ISO image for CD-ROM """ user_config = [" - name: {user_name}", @@ -381,6 +394,7 @@ class Libvirt(object): meta_data = "/tmp/meta-data" user_data = "/tmp/user-data" + network_data = "/tmp/network-config" with open(".".join([key_filename, "pub"]), "r") as pub_key_file: pub_key_str = pub_key_file.read().rstrip() user_conf = os.linesep.join(user_config).format(pub_key_str=pub_key_str, user_name=vm_user) @@ -388,10 +402,13 @@ class Libvirt(object): cmd_lst = [ "touch %s" % meta_data, USER_DATA_TEMPLATE.format(user_file=user_data, host=vm_name, user_config=user_conf), - "genisoimage -output {0} -volid cidata -joliet -r {1} {2}".format(file_path, - meta_data, - user_data), - "rm {0} {1}".format(meta_data, user_data), + NETWORK_DATA_TEMPLATE.format(network_file=network_data, mac_address=mac, + ip_address=ip), + "genisoimage -output {0} -volid cidata -joliet -r {1} {2} {3}".format(file_path, + meta_data, + user_data, + network_data), + "rm {0} {1} {2}".format(meta_data, user_data, network_data), ] for cmd in cmd_lst: LOG.info(cmd) @@ -537,7 +554,7 @@ class StandaloneContextHelper(object): return nodes @classmethod - def check_update_key(cls, connection, node, vm_name, id_name, cdrom_img): + def check_update_key(cls, connection, node, vm_name, id_name, cdrom_img, mac): # Generate public/private keys if private key file is not provided user_name = node.get('user') if not user_name: @@ -552,7 +569,9 @@ class StandaloneContextHelper(object): node['key_filename'] = key_filename # Update image with public key key_filename = node.get('key_filename') - Libvirt.gen_cdrom_image(connection, cdrom_img, vm_name, user_name, key_filename) + ip_netmask = "{0}/{1}".format(node.get('ip'), node.get('netmask')) + Libvirt.gen_cdrom_image(connection, cdrom_img, vm_name, user_name, key_filename, mac, + ip_netmask) return node @@ -567,7 +586,7 @@ class Server(object): for key, vfs in vnf["network_ports"].items(): if key == "mgmt": - mgmtip = str(IPNetwork(vfs['cidr']).ip) + mgmt_cidr = IPNetwork(vfs['cidr']) continue vf = ports[vfs[0]] @@ -584,14 +603,15 @@ class Server(object): }) index = index + 1 - return mgmtip, interfaces + return mgmt_cidr, interfaces @classmethod def generate_vnf_instance(cls, flavor, ports, ip, key, vnf, mac): - mgmtip, interfaces = cls.build_vnf_interfaces(vnf, ports) + mgmt_cidr, interfaces = cls.build_vnf_interfaces(vnf, ports) result = { - "ip": mgmtip, + "ip": str(mgmt_cidr.ip), + "netmask": str(mgmt_cidr.netmask), "mac": mac, "host": ip, "user": flavor.get('user', 'root'), diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py index 5891f798e..73311f0c2 100644 --- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py @@ -421,7 +421,8 @@ class OvsDpdkContext(base.Context): node, vm_name, self.name, - cdrom_img) + cdrom_img, + mac) # store vnf node details nodes.append(node) diff --git a/yardstick/benchmark/contexts/standalone/sriov.py b/yardstick/benchmark/contexts/standalone/sriov.py index 8d410b2f3..f1b67a2da 100644 --- a/yardstick/benchmark/contexts/standalone/sriov.py +++ b/yardstick/benchmark/contexts/standalone/sriov.py @@ -253,7 +253,8 @@ class SriovContext(base.Context): node, vm_name, self.name, - cdrom_img) + cdrom_img, + mac) # store vnf node details nodes.append(node) diff --git a/yardstick/common/constants.py b/yardstick/common/constants.py index 3d775d48e..03733b6da 100644 --- a/yardstick/common/constants.py +++ b/yardstick/common/constants.py @@ -176,3 +176,7 @@ SCOPE_CLUSTER = 'Cluster' # VNF definition SSH_PORT = 22 LUA_PORT = 22022 + +# IMIX mode +DISTRIBUTION_IN_PACKETS = 'mode_DIP' +DISTRIBUTION_IN_BYTES = 'mode_DIB' diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index 987029373..4b339c2ed 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -19,6 +19,7 @@ from trex_stl_lib import trex_stl_client from trex_stl_lib import trex_stl_packet_builder_scapy from trex_stl_lib import trex_stl_streams +from yardstick.common import constants from yardstick.network_services.traffic_profile import trex_traffic_profile @@ -140,7 +141,8 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): streams.extend(_streams) return trex_stl_streams.STLProfile(streams) - def _create_imix_data(self, imix): + def _create_imix_data(self, imix, + weight_mode=constants.DISTRIBUTION_IN_PACKETS): """Generate the IMIX distribution for a STL profile The input information is the framesize dictionary in a test case @@ -159,6 +161,20 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): E.g.: imix_count = {64: 25, 128: 75} + The weight mode is described in [1]. There are two ways to describe the + weight of the packets: + - Distribution in packets: the weight defines the percentage of + packets sent per packet size. IXIA uses this definition. + - Distribution in bytes: the weight defines the percentage of bytes + sent per packet size. + + Packet size # packets D. in packets Bytes D. in bytes + 40 7 58.33% 280 7% + 576 4 33.33% 2304 56% + 1500 1 8.33% 1500 37% + + [1] https://en.wikipedia.org/wiki/Internet_Mix + :param imix: (dict) IMIX size and weight """ imix_count = {} @@ -173,8 +189,16 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): imix_sum = 100 weight_normalize = float(imix_sum) / 100 - return {size: float(weight) / weight_normalize - for size, weight in imix_count.items()} + imix_dip = {size: float(weight) / weight_normalize + for size, weight in imix_count.items()} + + if weight_mode == constants.DISTRIBUTION_IN_BYTES: + return imix_dip + + byte_total = sum([int(size) * weight + for size, weight in imix_dip.items()]) + return {size: (int(size) * weight) / byte_total + for size, weight in imix_dip.items()} def _create_vm(self, packet_definition): """Create the STL Raw instructions""" diff --git a/yardstick/orchestrator/heat.py b/yardstick/orchestrator/heat.py index 99a5760a3..9da4948dd 100644 --- a/yardstick/orchestrator/heat.py +++ b/yardstick/orchestrator/heat.py @@ -471,68 +471,77 @@ name (i.e. %s). 'value': {'get_resource': name} } - def add_security_group(self, name): + def add_security_group(self, name, security_group=None): """add to the template a Neutron SecurityGroup""" log.debug("adding Neutron::SecurityGroup '%s'", name) + description = ("Group allowing IPv4 and IPv6 for icmp and upd/tcp on" + "all ports") + rules = [ + {'remote_ip_prefix': '0.0.0.0/0', + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '0.0.0.0/0', + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '0.0.0.0/0', + 'protocol': 'icmp'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'ethertype': 'IPv6', + 'protocol': 'ipv6-icmp'}, + {'remote_ip_prefix': '0.0.0.0/0', + 'direction': 'egress', + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '0.0.0.0/0', + 'direction': 'egress', + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '0.0.0.0/0', + 'direction': 'egress', + 'protocol': 'icmp'}, + {'remote_ip_prefix': '::/0', + 'direction': 'egress', + 'ethertype': 'IPv6', + 'protocol': 'tcp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'direction': 'egress', + 'ethertype': 'IPv6', + 'protocol': 'udp', + 'port_range_min': '1', + 'port_range_max': '65535'}, + {'remote_ip_prefix': '::/0', + 'direction': 'egress', + 'ethertype': 'IPv6', + 'protocol': 'ipv6-icmp'}, + ] + if security_group: + description = "Custom security group rules defined by the user" + rules = security_group.get('rules') + + log.debug("The security group rules is %s", rules) + self.resources[name] = { 'type': 'OS::Neutron::SecurityGroup', 'properties': { 'name': name, - 'description': "Group allowing IPv4 and IPv6 for icmp and upd/tcp on all ports", - 'rules': [ - {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'tcp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'udp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '0.0.0.0/0', - 'protocol': 'icmp'}, - {'remote_ip_prefix': '::/0', - 'ethertype': 'IPv6', - 'protocol': 'tcp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '::/0', - 'ethertype': 'IPv6', - 'protocol': 'udp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '::/0', - 'ethertype': 'IPv6', - 'protocol': 'ipv6-icmp'}, - {'remote_ip_prefix': '0.0.0.0/0', - 'direction': 'egress', - 'protocol': 'tcp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '0.0.0.0/0', - 'direction': 'egress', - 'protocol': 'udp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '0.0.0.0/0', - 'direction': 'egress', - 'protocol': 'icmp'}, - {'remote_ip_prefix': '::/0', - 'direction': 'egress', - 'ethertype': 'IPv6', - 'protocol': 'tcp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '::/0', - 'direction': 'egress', - 'ethertype': 'IPv6', - 'protocol': 'udp', - 'port_range_min': '1', - 'port_range_max': '65535'}, - {'remote_ip_prefix': '::/0', - 'direction': 'egress', - 'ethertype': 'IPv6', - 'protocol': 'ipv6-icmp'}, - ] + 'description': description, + 'rules': rules } } diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py index 371e4ef36..98d2b1836 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_model.py @@ -205,10 +205,13 @@ class ModelLibvirtTestCase(unittest.TestCase): hostname = root.find('name').text meta_data = "/tmp/meta-data" user_data = "/tmp/user-data" + network_data = "/tmp/network-config" file_path = "/tmp/cdrom-0.img" key_filename = "id_rsa" pub_key_str = "KEY" user = 'root' + mac = "00:11:22:33:44:55" + ip = "1.1.1.7/24" user_config = [" - name: {user_name}", " ssh_authorized_keys:", " - {pub_key_str}"] @@ -218,7 +221,8 @@ class ModelLibvirtTestCase(unittest.TestCase): create=True) as mock_file: with open(key_filename, "r") as h: result = h.read() - model.Libvirt.gen_cdrom_image(self.mock_ssh, file_path, hostname, user, key_filename) + model.Libvirt.gen_cdrom_image(self.mock_ssh, file_path, hostname, user, key_filename, + mac, ip) mock_file.assert_called_with(".".join([key_filename, "pub"]), "r") self.assertEqual(result, pub_key_str) @@ -226,9 +230,12 @@ class ModelLibvirtTestCase(unittest.TestCase): mock.call("touch %s" % meta_data), mock.call(model.USER_DATA_TEMPLATE.format(user_file=user_data, host=hostname, user_config=user_conf)), + mock.call(model.NETWORK_DATA_TEMPLATE.format(network_file=network_data, + mac_address=mac, ip_address=ip)), mock.call("genisoimage -output {0} -volid cidata" - " -joliet -r {1} {2}".format(file_path, meta_data, user_data)), - mock.call("rm {0} {1}".format(meta_data, user_data)) + " -joliet -r {1} {2} {3}".format(file_path, meta_data, user_data, + network_data)), + mock.call("rm {0} {1} {2}".format(meta_data, user_data, network_data)) ]) def test_create_snapshot_qemu(self): @@ -273,16 +280,22 @@ class ModelLibvirtTestCase(unittest.TestCase): @mock.patch.object(model.Libvirt, 'gen_cdrom_image') def test_check_update_key(self, mock_gen_cdrom_image): - node = {'user': 'defuser', 'key_filename': '/home/ubuntu/id_rsa'} + node = { + 'user': 'defuser', + 'key_filename': '/home/ubuntu/id_rsa', + 'ip': '1.1.1.7', + 'netmask': '255.255.255.0'} cdrom_img = "/var/lib/libvirt/images/data.img" id_name = 'fake_name' key_filename = node.get('key_filename') root = ElementTree.fromstring(self.XML_STR) hostname = root.find('name').text + mac = "00:11:22:33:44:55" + ip = "{0}/{1}".format(node.get('ip'), node.get('netmask')) model.StandaloneContextHelper.check_update_key(self.mock_ssh, node, hostname, id_name, - cdrom_img) + cdrom_img, mac) mock_gen_cdrom_image.assert_called_once_with(self.mock_ssh, cdrom_img, hostname, - node.get('user'), key_filename) + node.get('user'), key_filename, mac, ip) @mock.patch.object(os, 'access', return_value=False) def test_create_snapshot_qemu_no_image_local(self, mock_os_access): diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py index 1a2407575..6cc8b11f3 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py @@ -418,7 +418,8 @@ class OvsDpdkContextTestCase(unittest.TestCase): self.ovs_dpdk.configure_nics_for_ovs_dpdk = mock.Mock(return_value="") self.ovs_dpdk._name_task_id = 'fake_name' xml_str = 'vm-0' - mock_build_xml.return_value = (xml_str, '00:00:00:00:00:01') + self.ovs_dpdk.mac = '00:00:00:00:00:01' + mock_build_xml.return_value = (xml_str, self.ovs_dpdk.mac) self.ovs_dpdk._enable_interfaces = mock.Mock(return_value=xml_str) vnf_instance = mock.Mock() vnf_instance_2 = mock.Mock() @@ -439,7 +440,8 @@ class OvsDpdkContextTestCase(unittest.TestCase): vnf_instance, xml_str, self.ovs_dpdk._name_task_id, - self.ovs_dpdk.file_path) + self.ovs_dpdk.file_path, + self.ovs_dpdk.mac) @mock.patch.object(io, 'BytesIO') def test__check_hugepages(self, mock_bytesio): diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py index ae8e95f9a..316aca72a 100644 --- a/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py +++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_sriov.py @@ -301,8 +301,9 @@ class SriovContextTestCase(unittest.TestCase): self.sriov._name_task_id = 'fake_name' cfg = '/tmp/vm_sriov_0.xml' vm_name = 'vm-0' + mac = '00:00:00:00:00:01' xml_out = mock.Mock() - mock_build_vm_xml.return_value = (xml_out, '00:00:00:00:00:01') + mock_build_vm_xml.return_value = (xml_out, mac) mock_check_update_key.return_value = 'node_2' cdrom_img = '/var/lib/libvirt/images/cdrom-0.img' @@ -314,7 +315,8 @@ class SriovContextTestCase(unittest.TestCase): return_value='node_1') nodes_out = self.sriov.setup_sriov_context() mock_check_update_key.assert_called_once_with(connection, 'node_1', vm_name, - self.sriov._name_task_id, cdrom_img) + self.sriov._name_task_id, cdrom_img, + mac) self.assertEqual(['node_2'], nodes_out) mock_vnf_node.generate_vnf_instance.assert_called_once_with( 'flavor', 'networks', '1.2.3.4', 'vnf_0', diff --git a/yardstick/tests/unit/benchmark/contexts/test_heat.py b/yardstick/tests/unit/benchmark/contexts/test_heat.py index 7782d96bd..3ccae44c7 100644 --- a/yardstick/tests/unit/benchmark/contexts/test_heat.py +++ b/yardstick/tests/unit/benchmark/contexts/test_heat.py @@ -73,6 +73,7 @@ class HeatContextTestCase(unittest.TestCase): self.assertEqual(self.test_context.server_groups, []) self.assertIsNone(self.test_context.keypair_name) self.assertIsNone(self.test_context.secgroup_name) + self.assertIsNone(self.test_context.security_group) self.assertEqual(self.test_context._server_map, {}) self.assertIsNone(self.test_context._image) self.assertIsNone(self.test_context._flavor) @@ -192,7 +193,7 @@ class HeatContextTestCase(unittest.TestCase): mock_template.add_keypair.assert_called_with( "ctx-key", "ctx-12345678") - mock_template.add_security_group.assert_called_with("ctx-secgroup") + mock_template.add_security_group.assert_called_with("ctx-secgroup", None) mock_template.add_network.assert_called_with( "ctx-12345678-mynet", 'physnet1', None, None, None, None) mock_template.add_router.assert_called_with( diff --git a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py index cfeebaa3a..4c546d7ef 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -20,6 +20,7 @@ from trex_stl_lib import trex_stl_client from trex_stl_lib import trex_stl_packet_builder_scapy from trex_stl_lib import trex_stl_streams +from yardstick.common import constants from yardstick.network_services.traffic_profile import rfc2544 from yardstick.tests.unit import base @@ -140,16 +141,38 @@ class TestRFC2544Profile(base.BaseUnitTestCase): port_pg_id, True) mock_stl_profile.assert_called_once_with(['stream1']) - def test__create_imix_data(self): + def test__create_imix_data_mode_DIB(self): rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) data = {'64B': 50, '128B': 50} - self.assertEqual({'64': 50.0, '128': 50.0}, - rfc2544_profile._create_imix_data(data)) + self.assertEqual( + {'64': 50.0, '128': 50.0}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) data = {'64B': 1, '128b': 3} - self.assertEqual({'64': 25.0, '128': 75.0}, - rfc2544_profile._create_imix_data(data)) + self.assertEqual( + {'64': 25.0, '128': 75.0}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) data = {} - self.assertEqual({}, rfc2544_profile._create_imix_data(data)) + self.assertEqual( + {}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_BYTES)) + + def test__create_imix_data_mode_DIP(self): + rfc2544_profile = rfc2544.RFC2544Profile(self.TRAFFIC_PROFILE) + data = {'64B': 25, '128B': 25, '512B': 25, '1518B': 25} + byte_total = 64 * 25 + 128 * 25 + 512 * 25 + 1518 * 25 + self.assertEqual( + {'64': 64 * 25.0 / byte_total, '128': 128 * 25.0 / byte_total, + '512': 512 * 25.0 / byte_total, '1518': 1518 * 25.0 / byte_total}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) + data = {} + self.assertEqual( + {}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) def test__create_vm(self): packet = {'outer_l2': 'l2_definition'} diff --git a/yardstick/tests/unit/orchestrator/test_heat.py b/yardstick/tests/unit/orchestrator/test_heat.py index 3ec59a3c2..2e60a72cb 100644 --- a/yardstick/tests/unit/orchestrator/test_heat.py +++ b/yardstick/tests/unit/orchestrator/test_heat.py @@ -256,6 +256,25 @@ class HeatTemplateTestCase(unittest.TestCase): self.assertEqual(self.template.resources['some-server-group'][ 'properties']['policies'], ['anti-affinity']) + def test_add_security_group(self): + security_group = { + 'rules': [ + {'remote_ip_prefix': '0.0.0.0/0', + 'port_range_max': 65535, + 'port_range_min': 1, + 'protocol': 'custom'}, + ] + } + self.template.add_security_group('some-security-group', security_group) + + secgroup_rsc = self.template.resources['some-security-group'] + + self.assertEqual(secgroup_rsc['type'], "OS::Neutron::SecurityGroup") + self.assertEqual(secgroup_rsc['properties']['description'], + "Custom security group rules defined by the user") + self.assertEqual(secgroup_rsc['properties']['rules'][0]['protocol'], + 'custom') + def test__add_resources_to_template_raw(self): test_context = node.NodeContext() self.addCleanup(test_context._delete_context) |