diff options
20 files changed, 257 insertions, 63 deletions
diff --git a/ansible/infra_deploy.yml b/ansible/infra_deploy.yml index 8cf5dffef..4a5716eee 100644 --- a/ansible/infra_deploy.yml +++ b/ansible/infra_deploy.yml @@ -27,6 +27,7 @@ proxy_host_ip: "{{ lookup('dig', proxy_host) }}" roles: + - infra_install_dependencies - infra_destroy_previous_configuration - infra_check_requirements - infra_create_network diff --git a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml index 34bfd1b71..12b2726dc 100644 --- a/ansible/roles/infra_create_vms/tasks/create_interfaces.yml +++ b/ansible/roles/infra_create_vms/tasks/create_interfaces.yml @@ -12,6 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. --- +- set_fact: + mac_address_arg: "mac_address" + +- set_fact: + mac_address_arg: "macaddress" + when: + - ansible_distribution == 'Ubuntu' + - ansible_distribution_major_version|int >= 18 + - name: Add network-data blockinfile: path: "{{ network_config }}" @@ -20,9 +29,9 @@ block: |2 {{ 'enp0s%d:'| format( slot_address | int) }} match: - mac_address: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }} + {{ mac_address_arg }}: {{ '52:54:00:5d:7d:%02x'| format( mac_address_counter | int) }} addresses: - - {{ interface_item.ip }}/{{ interface_item.netmask }} + - {{ interface_item.ip }}/{{ (interface_item.ip + '/' + interface_item.netmask) | ipaddr('prefix') }} - name: Add default gateway blockinfile: diff --git a/ansible/roles/infra_install_dependencies/tasks/Debian.yml b/ansible/roles/infra_install_dependencies/tasks/Debian.yml new file mode 100644 index 000000000..9f4dc1046 --- /dev/null +++ b/ansible/roles/infra_install_dependencies/tasks/Debian.yml @@ -0,0 +1,34 @@ +# Copyright (c) 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.
+# 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.
+---
+- name: Update repositories
+ apt:
+ update_cache: yes
+
+- name: Install core packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - python-libvirt
+ - genisoimage
+ when: ansible_distribution_major_version|int == 16
+
+- name: Install core packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=present"
+ with_items:
+ - python-pip
+ - python-libvirt
+ - python-lxml
+ - python-netaddr
+ - genisoimage
+ when: ansible_distribution_major_version|int >= 18
diff --git a/ansible/roles/infra_install_dependencies/tasks/main.yml b/ansible/roles/infra_install_dependencies/tasks/main.yml new file mode 100644 index 000000000..115b1e3b9 --- /dev/null +++ b/ansible/roles/infra_install_dependencies/tasks/main.yml @@ -0,0 +1,15 @@ +# Copyright (c) 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.
+# 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.
+---
+- include_tasks: "{{ ansible_os_family }}.yml"
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/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml index 906793740..f71c08861 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency.yaml @@ -53,7 +53,8 @@ uplink_0: srcip4: "{{get(flow, 'flow.src_ip_0', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.dst_ip_0', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -86,7 +87,8 @@ downlink_0: dstip4: "{{get(flow, 'flow.public_ip_0', '90.90.1.1-90.105.255.255') }}" {% endif %} count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -116,7 +118,8 @@ uplink_1: srcip4: "{{get(flow, 'flow.src_ip_1', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.dst_ip_1', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -149,7 +152,8 @@ downlink_1: dstip4: "{{get(flow, 'flow.public_ip_1', '90.90.1.1-90.105.255.255') }}" {% endif %} count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml index 6e2f8ec7c..9e8f67216 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_cgnapt.yaml @@ -51,7 +51,8 @@ uplink_0: srcip4: "{{get(flow, 'flow.src_ip_0', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.dst_ip_0', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -79,7 +80,8 @@ downlink_0: srcip4: "{{get(flow, 'flow.dst_ip_0', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.public_ip_0', '10.0.2.1-10.0.2.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -107,7 +109,8 @@ uplink_1: srcip4: "{{get(flow, 'flow.src_ip_1', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.dst_ip_1', '90.90.1.1-90.105.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: @@ -135,7 +138,8 @@ downlink_1: srcip4: "{{get(flow, 'flow.dst_ip_1', '1.1.1.1-1.15.255.255') }}" dstip4: "{{get(flow, 'flow.public_ip_1', '10.0.2.1-10.0.2.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 0 outer_l4: diff --git a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml index cfc5f1ea3..7942fbf4d 100644 --- a/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml +++ b/samples/vnf_samples/traffic_profiles/ixia_ipv4_latency_vpe.yaml @@ -73,7 +73,8 @@ uplink_0: srcip4: "{{get(flow, 'flow.src_ip_0', '192.168.0.0-192.168.255.255') }}" dstip4: "{{get(flow, 'flow.dst_ip_0', '192.16.0.0-192.16.0.31') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 32 @@ -100,7 +101,8 @@ downlink_0: srcip4: "{{get(flow, 'flow.dst_ip_0', '192.16.0.0-192.16.0.31') }}" dstip4: "{{get(flow, 'flow.src_ip_0', '192.168.0.0-192.168.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 32 @@ -137,7 +139,8 @@ uplink_1: srcip4: "{{get(flow, 'flow.srcip_1', '192.168.0.0-192.168.255.255') }}" dstip4: "{{get(flow, 'flow.dstip_1', '192.16.0.0-192.16.0.31') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 32 @@ -164,7 +167,8 @@ downlink_1: srcip4: "{{get(flow, 'flow.dst_ip_1', '192.16.0.0-192.16.0.31') }}" dstip4: "{{get(flow, 'flow.src_ip_1', '192.168.0.0-192.168.255.255') }}" count: "{{get(flow, 'flow.count', '1') }}" - seed: "{{get(flow, 'flow.seed', '1') }}" + srcseed: "{{get(flow, 'flow.srcseed', '1') }}" + dstseed: "{{get(flow, 'flow.dstseed', '1') }}" ttl: 32 dscp: 32 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/benchmark/scenarios/networking/vnf_generic.py b/yardstick/benchmark/scenarios/networking/vnf_generic.py index 4884e57a8..6d68c5e64 100644 --- a/yardstick/benchmark/scenarios/networking/vnf_generic.py +++ b/yardstick/benchmark/scenarios/networking/vnf_generic.py @@ -120,8 +120,11 @@ class NetworkServiceTestCase(scenario_base.Scenario): if "count" in fflow: flow["count"] = fflow["count"] - if "seed" in fflow: - flow["seed"] = fflow["seed"] + if "srcseed" in fflow: + flow["srcseed"] = fflow["srcseed"] + + if "dstseed" in fflow: + flow["dstseed"] = fflow["dstseed"] except KeyError: flow = {} diff --git a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py index 8274ff9ce..29533808c 100644 --- a/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py +++ b/yardstick/network_services/libs/ixia_libs/ixnet/ixnet_api.py @@ -477,16 +477,17 @@ class IxNextgen(object): # pragma: no cover count = traffic_param['outer_l3']['count'] srcip = str(traffic_param['outer_l3']['srcip']) dstip = str(traffic_param['outer_l3']['dstip']) - seed = traffic_param['outer_l3']['seed'] + srcseed = traffic_param['outer_l3']['srcseed'] + dstseed = traffic_param['outer_l3']['dstseed'] srcmask = traffic_param['outer_l3']['srcmask'] or IP_VERSION_4_MASK dstmask = traffic_param['outer_l3']['dstmask'] or IP_VERSION_4_MASK self._update_ipv4_address( self._get_stack_item(fg_id, PROTO_IPV4)[0], - 'srcIp', srcip, seed, srcmask, count) + 'srcIp', srcip, srcseed, srcmask, count) self._update_ipv4_address( self._get_stack_item(fg_id, PROTO_IPV4)[0], - 'dstIp', dstip, seed, dstmask, count) + 'dstIp', dstip, dstseed, dstmask, count) def update_l4(self, traffic): """Update the L4 headers diff --git a/yardstick/network_services/traffic_profile/ixia_rfc2544.py b/yardstick/network_services/traffic_profile/ixia_rfc2544.py index 461604fb8..44bf2eafc 100644 --- a/yardstick/network_services/traffic_profile/ixia_rfc2544.py +++ b/yardstick/network_services/traffic_profile/ixia_rfc2544.py @@ -96,7 +96,8 @@ class IXIARFC2544Profile(trex_traffic_profile.TrexProfile): 'count': ip['count'], 'dscp': ip['dscp'], 'ttl': ip['ttl'], - 'seed': ip.get('seed', 1), + 'srcseed': ip.get('srcseed', 1), + 'dstseed': ip.get('dstseed', 1), 'srcip': srcip, 'dstip': dstip, 'srcmask': srcmask, diff --git a/yardstick/network_services/traffic_profile/rfc2544.py b/yardstick/network_services/traffic_profile/rfc2544.py index 4b339c2ed..e33c437c9 100644 --- a/yardstick/network_services/traffic_profile/rfc2544.py +++ b/yardstick/network_services/traffic_profile/rfc2544.py @@ -197,7 +197,7 @@ class RFC2544Profile(trex_traffic_profile.TrexProfile): byte_total = sum([int(size) * weight for size, weight in imix_dip.items()]) - return {size: (int(size) * weight) / byte_total + return {size: (int(size) * weight * 100) / byte_total for size, weight in imix_dip.items()} def _create_vm(self, packet_definition): 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/network_services/libs/ixia_libs/test_ixnet_api.py b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py index e078d70ad..92ceeae83 100644 --- a/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py +++ b/yardstick/tests/unit/network_services/libs/ixia_libs/test_ixnet_api.py @@ -38,7 +38,8 @@ TRAFFIC_PARAMETERS = { }, 'outer_l3': { 'count': 512, - 'seed': 1, + 'srcseed': 10, + 'dstseed': 20, 'dscp': 0, 'proto': 'udp', 'ttl': 32, @@ -69,7 +70,8 @@ TRAFFIC_PARAMETERS = { }, 'outer_l3': { 'count': 1024, - 'seed': 1, + 'srcseed': 30, + 'dstseed': 40, 'dscp': 0, 'proto': 'udp', 'ttl': 32, 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 4c546d7ef..b8fbc6344 100644 --- a/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py +++ b/yardstick/tests/unit/network_services/traffic_profile/test_rfc2544.py @@ -164,8 +164,10 @@ class TestRFC2544Profile(base.BaseUnitTestCase): 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}, + {'64': 64 * 25.0 * 100 / byte_total, + '128': 128 * 25.0 * 100 / byte_total, + '512': 512 * 25.0 * 100 / byte_total, + '1518': 1518 * 25.0 * 100/ byte_total}, rfc2544_profile._create_imix_data( data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) data = {} @@ -173,6 +175,11 @@ class TestRFC2544Profile(base.BaseUnitTestCase): {}, rfc2544_profile._create_imix_data( data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) + data = {'64B': 100} + self.assertEqual( + {'64': 100.0}, + rfc2544_profile._create_imix_data( + data, weight_mode=constants.DISTRIBUTION_IN_PACKETS)) def test__create_vm(self): packet = {'outer_l2': 'l2_definition'} |