aboutsummaryrefslogtreecommitdiffstats
path: root/docs/testing/user/userguide/13-nsb-installation.rst
blob: 973d56628269469d457b454fe2371960db2f462a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Variable.Class */
.highlight .vg { color: #f8f8f2 } /* Name.Variable.Global */
.highlight .vi { color: #f8f8f2 } /* Name.Variable.Instance */
.highlight .vm { color: #f8f8f2 } /* Name.Variable.Magic */
.highlight .il { color: #ae81ff } /* Literal.Number.Integer.Long */
}
@media (prefers-color-scheme: light) {
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
}
Name:		opnfv-apex-onos
Version:	3.0
Release:	%{release}
Summary:	Overcloud Disk images for OPNFV Apex ONOS deployment

Group:		System Environment
License:	Apache 2.0
URL:		https://gerrit.opnfv.org/gerrit/apex.git
Source0:	opnfv-apex-onos.tar.gz

Provides:       opnfv-apex-sdn
BuildArch:	noarch
Requires:	opnfv-apex-common opnfv-apex-undercloud

%description
Overcloud Disk images for OPNFV Apex ONOS deployment
https://wiki.opnfv.org/apex

%prep
%setup -q

%install
mkdir -p %{buildroot}%{_var}/opt/opnfv/images/
install build/images/overcloud-full-onos.qcow2 %{buildroot}%{_var}/opt/opnfv/images/

%files
%defattr(644, root, root, -)
%{_var}/opt/opnfv/images/overcloud-full-onos.qcow2

%changelog
* Mon Apr 04 2016 Dan Radez <dradez@redhat.com> - 3.0-0
- Version update for Colorado
* Mon Mar 07 2016 Dan Radez <dradez@redhat.com> - 2.1-1
- Initial Packaging
'n369' href='#n369'>369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243
.. This work is licensed under a Creative Commons Attribution 4.0 International
.. License.
.. http://creativecommons.org/licenses/by/4.0
.. (c) OPNFV, 2016-2018 Intel Corporation.

..
   Convention for heading levels in Yardstick documentation:

   =======  Heading 0 (reserved for the title in a document)
   -------  Heading 1
   ~~~~~~~  Heading 2
   +++++++  Heading 3
   '''''''  Heading 4

   Avoid deeper levels because they do not render well.

=====================================
Yardstick - NSB Testing -Installation
=====================================

Abstract
--------

The Network Service Benchmarking (NSB) extends the yardstick framework to do
VNF characterization and benchmarking in three different execution
environments viz., bare metal i.e. native Linux environment, standalone virtual
environment and managed virtualized environment (e.g. Open stack etc.).
It also brings in the capability to interact with external traffic generators
both hardware & software based for triggering and validating the traffic
according to user defined profiles.

The steps needed to run Yardstick with NSB testing are:

* Install Yardstick (NSB Testing).
* Setup/Reference pod.yaml describing Test topology
* Create/Reference the test configuration yaml file.
* Run the test case.


Prerequisites
-------------

Refer chapter Yardstick Installation for more information on yardstick
prerequisites

Several prerequisites are needed for Yardstick (VNF testing):

  * Python Modules: pyzmq, pika.
  * flex
  * bison
  * build-essential
  * automake
  * libtool
  * librabbitmq-dev
  * rabbitmq-server
  * collectd
  * intel-cmt-cat

Hardware & Software Ingredients
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

SUT requirements:


   ======= ===================
   Item    Description
   ======= ===================
   Memory  Min 20GB
   NICs    2 x 10G
   OS      Ubuntu 16.04.3 LTS
   kernel  4.4.0-34-generic
   DPDK    17.02
   ======= ===================

Boot and BIOS settings:


   ============= =================================================
   Boot settings default_hugepagesz=1G hugepagesz=1G hugepages=16
                 hugepagesz=2M hugepages=2048 isolcpus=1-11,22-33
                 nohz_full=1-11,22-33 rcu_nocbs=1-11,22-33
                 iommu=on iommu=pt intel_iommu=on
                 Note: nohz_full and rcu_nocbs is to disable Linux
                 kernel interrupts
   BIOS          CPU Power and Performance Policy <Performance>
                 CPU C-state Disabled
                 CPU P-state Disabled
                 Enhanced Intel® Speedstep® Tech Disabl
                 Hyper-Threading Technology (If supported) Enabled
                 Virtualization Techology Enabled
                 Intel(R) VT for Direct I/O Enabled
                 Coherency Enabled
                 Turbo Boost Disabled
   ============= =================================================



Install Yardstick (NSB Testing)
-------------------------------

Download the source code and install Yardstick from it

.. code-block:: console

  git clone https://gerrit.opnfv.org/gerrit/yardstick

  cd yardstick

  # Switch to latest stable branch
  # git checkout <tag or stable branch>
  git checkout stable/euphrates

Configure the network proxy, either using the environment variables or setting
the global environment file:

.. code-block:: ini

    cat /etc/environment
    http_proxy='http://proxy.company.com:port'
    https_proxy='http://proxy.company.com:port'

.. code-block:: console

    export http_proxy='http://proxy.company.com:port'
    export https_proxy='http://proxy.company.com:port'

The last step is to modify the Yardstick installation inventory, used by
Ansible:

.. code-block:: ini

  cat ./ansible/install-inventory.ini
  [jumphost]
  localhost  ansible_connection=local

  [yardstick-standalone]
  yardstick-standalone-node ansible_host=192.168.1.2
  yardstick-standalone-node-2 ansible_host=192.168.1.3

  # section below is only due backward compatibility.
  # it will be removed later
  [yardstick:children]
  jumphost

  [all:vars]
  ansible_user=root
  ansible_pass=root

.. note::

   SSH access without password needs to be configured for all your nodes defined in
   ``install-inventory.ini`` file.
   If you want to use password authentication you need to install sshpass

   .. code-block:: console

     sudo -EH apt-get install sshpass

To execute an installation for a Bare-Metal or a Standalone context:

.. code-block:: console

    ./nsb_setup.sh


To execute an installation for an OpenStack context:

.. code-block:: console

    ./nsb_setup.sh <path to admin-openrc.sh>

Above command setup docker with latest yardstick code. To execute

.. code-block:: console

  docker exec -it yardstick bash

It will also automatically download all the packages needed for NSB Testing
setup. Refer chapter :doc:`04-installation` for more on docker
**Install Yardstick using Docker (recommended)**

Another way to execute an installation for a Bare-Metal or a Standalone context
is to use ansible script ``install.yaml``. Refer chapter :doc:`04-installation`
for more details.

System Topology
---------------

.. code-block:: console

  +----------+              +----------+
  |          |              |          |
  |          | (0)----->(0) |          |
  |    TG1   |              |    DUT   |
  |          |              |          |
  |          | (1)<-----(1) |          |
  +----------+              +----------+
  trafficgen_1                   vnf


Environment parameters and credentials
--------------------------------------

Config yardstick conf
~~~~~~~~~~~~~~~~~~~~~

If user did not run 'yardstick env influxdb' inside the container, which will
generate correct ``yardstick.conf``, then create the config file manually (run
inside the container):
::

    cp ./etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
    vi /etc/yardstick/yardstick.conf

Add trex_path, trex_client_lib and bin_path in 'nsb' section.

::

  [DEFAULT]
  debug = True
  dispatcher = file, influxdb

  [dispatcher_influxdb]
  timeout = 5
  target = http://{YOUR_IP_HERE}:8086
  db_name = yardstick
  username = root
  password = root

  [nsb]
  trex_path=/opt/nsb_bin/trex/scripts
  bin_path=/opt/nsb_bin
  trex_client_lib=/opt/nsb_bin/trex_client/stl

Run Yardstick - Network Service Testcases
-----------------------------------------


NS testing - using yardstick CLI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  See :doc:`04-installation`

.. code-block:: console


  docker exec -it yardstick /bin/bash
  source /etc/yardstick/openstack.creds (only for heat TC if nsb_setup.sh was NOT used)
  export EXTERNAL_NETWORK="<openstack public network>" (only for heat TC)
  yardstick --debug task start yardstick/samples/vnf_samples/nsut/<vnf>/<test case>

Network Service Benchmarking - Bare-Metal
-----------------------------------------

Bare-Metal Config pod.yaml describing Topology
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Bare-Metal 2-Node setup
+++++++++++++++++++++++
.. code-block:: console

  +----------+              +----------+
  |          |              |          |
  |          | (0)----->(0) |          |
  |    TG1   |              |    DUT   |
  |          |              |          |
  |          | (n)<-----(n) |          |
  +----------+              +----------+
  trafficgen_1                   vnf

Bare-Metal 3-Node setup - Correlated Traffic
++++++++++++++++++++++++++++++++++++++++++++
.. code-block:: console

  +----------+              +----------+            +------------+
  |          |              |          |            |            |
  |          |              |          |            |            |
  |          | (0)----->(0) |          |            |    UDP     |
  |    TG1   |              |    DUT   |            |   Replay   |
  |          |              |          |            |            |
  |          |              |          |(1)<---->(0)|            |
  +----------+              +----------+            +------------+
  trafficgen_1                   vnf                 trafficgen_2


Bare-Metal Config pod.yaml
~~~~~~~~~~~~~~~~~~~~~~~~~~
Before executing Yardstick test cases, make sure that pod.yaml reflects the
topology and update all the required fields.::

    cp /etc/yardstick/nodes/pod.yaml.nsb.sample /etc/yardstick/nodes/pod.yaml

.. code-block:: YAML

    nodes:
    -
        name: trafficgen_1
        role: TrafficGen
        ip: 1.1.1.1
        user: root
        password: r00t
        interfaces:
            xe0:  # logical name from topology.yaml and vnfd.yaml
                vpci:      "0000:07:00.0"
                driver:    i40e # default kernel driver
                dpdk_port_num: 0
                local_ip: "152.16.100.20"
                netmask:   "255.255.255.0"
                local_mac: "00:00:00:00:00:01"
            xe1:  # logical name from topology.yaml and vnfd.yaml
                vpci:      "0000:07:00.1"
                driver:    i40e # default kernel driver
                dpdk_port_num: 1
                local_ip: "152.16.40.20"
                netmask:   "255.255.255.0"
                local_mac: "00:00.00:00:00:02"

    -
        name: vnf
        role: vnf
        ip: 1.1.1.2
        user: root
        password: r00t
        host: 1.1.1.2 #BM - host == ip, virtualized env - Host - compute node
        interfaces:
            xe0:  # logical name from topology.yaml and vnfd.yaml
                vpci:      "0000:07:00.0"
                driver:    i40e # default kernel driver
                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:07:00.1"
                driver:    i40e # default kernel driver
                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"


Network Service Benchmarking - Standalone Virtualization
--------------------------------------------------------

SR-IOV
~~~~~~

SR-IOV Pre-requisites
+++++++++++++++++++++

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 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'

 c) Build guest image for VNF to run.
    Most of the sample test cases in Yardstick are using a guest image called
    ``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
    following the commands below::

       sudo apt-get update && sudo apt-get install -y qemu-utils kpartx

    This image can be built using the following command in the directory where Yardstick is installed

    .. code-block:: console

       export YARD_IMG_ARCH='amd64'
       sudo echo "Defaults env_keep += \'YARD_IMG_ARCH\'" >> /etc/sudoers

    Please use ansible script to generate a cloud image refer to :doc:`04-installation`

    for more details refer to chapter :doc:`04-installation`

    .. note:: VM should be build with static IP and should be accessible from yardstick host.


SR-IOV Config pod.yaml describing Topology
++++++++++++++++++++++++++++++++++++++++++

SR-IOV 2-Node setup
+++++++++++++++++++
.. code-block:: console

                               +--------------------+
                               |                    |
                               |                    |
                               |        DUT         |
                               |       (VNF)        |
                               |                    |
                               +--------------------+
                               | VF NIC |  | VF NIC |
                               +--------+  +--------+
                                     ^          ^
                                     |          |
                                     |          |
  +----------+               +-------------------------+
  |          |               |       ^          ^      |
  |          |               |       |          |      |
  |          | (0)<----->(0) | ------           |      |
  |    TG1   |               |           SUT    |      |
  |          |               |                  |      |
  |          | (n)<----->(n) |------------------       |
  +----------+               +-------------------------+
  trafficgen_1                          host



SR-IOV 3-Node setup - Correlated Traffic
++++++++++++++++++++++++++++++++++++++++
.. code-block:: console

                               +--------------------+
                               |                    |
                               |                    |
                               |        DUT         |
                               |       (VNF)        |
                               |                    |
                               +--------------------+
                               | VF NIC |  | VF NIC |
                               +--------+  +--------+
                                     ^          ^
                                     |          |
                                     |          |
  +----------+               +-------------------------+            +--------------+
  |          |               |       ^          ^      |            |              |
  |          |               |       |          |      |            |              |
  |          | (0)<----->(0) | ------           |      |            |     TG2      |
  |    TG1   |               |           SUT    |      |            | (UDP Replay) |
  |          |               |                  |      |            |              |
  |          | (n)<----->(n) |                  ------ | (n)<-->(n) |              |
  +----------+               +-------------------------+            +--------------+
  trafficgen_1                          host                       trafficgen_2

Before executing Yardstick test cases, make sure that pod.yaml reflects the
topology and update all the required fields.

.. code-block:: console

    cp <yardstick>/etc/yardstick/nodes/standalone/trex_bm.yaml.sample /etc/yardstick/nodes/standalone/pod_trex.yaml
    cp <yardstick>/etc/yardstick/nodes/standalone/host_sriov.yaml /etc/yardstick/nodes/standalone/host_sriov.yaml

.. note:: Update all the required fields like ip, user, password, pcis, etc...

SR-IOV Config pod_trex.yaml
+++++++++++++++++++++++++++

.. code-block:: YAML

    nodes:
    -
        name: trafficgen_1
        role: TrafficGen
        ip: 1.1.1.1
        user: root
        password: r00t
        key_filename: /root/.ssh/id_rsa
        interfaces:
            xe0:  # logical name from topology.yaml and vnfd.yaml
                vpci:      "0000:07:00.0"
                driver:    i40e # default kernel driver
                dpdk_port_num: 0
                local_ip: "152.16.100.20"
                netmask:   "255.255.255.0"
                local_mac: "00:00:00:00:00:01"
            xe1:  # logical name from topology.yaml and vnfd.yaml
                vpci:      "0000:07:00.1"
                driver:    i40e # default kernel driver
                dpdk_port_num: 1
                local_ip: "152.16.40.20"
                netmask:   "255.255.255.0"
                local_mac: "00:00.00:00:00:02"

SR-IOV Config host_sriov.yaml
+++++++++++++++++++++++++++++

.. code-block:: YAML

    nodes:
    -
       name: sriov
       role: Sriov
       ip: 192.168.100.101
       user: ""
       password: ""

SR-IOV testcase update:
``<yardstick>/samples/vnf_samples/nsut/vfw/tc_sriov_rfc2544_ipv4_1rule_1flow_64B_trex.yaml``

Update "contexts" section
'''''''''''''''''''''''''

.. code-block:: YAML

  contexts:
   - name: yardstick
     type: Node
     file: /etc/yardstick/nodes/standalone/pod_trex.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
       extra_specs:
         hw:cpu_sockets: 1
         hw:cpu_cores: 6
         hw:cpu_threads: 2
       user: "" # update VM username
       password: "" # update password
     servers:
       vnf:
         network_ports:
           mgmt:
             cidr: '1.1.1.61/24'  # Update VM IP address, if static, <ip>/<mask> or if dynamic, <start of ip>/<mask>
           xe0:
             - uplink_0
           xe1:
             - downlink_0
     networks:
       uplink_0:
         phy_port: "0000:05:00.0"
         vpci: "0000:00:07.0"
         cidr: '152.16.100.10/24'
         gateway_ip: '152.16.100.20'
       downlink_0:
         phy_port: "0000:05:00.1"
         vpci: "0000:00:08.0"
         cidr: '152.16.40.10/24'
         gateway_ip: '152.16.100.20'



OVS-DPDK
~~~~~~~~

OVS-DPDK Pre-requisites
~~~~~~~~~~~~~~~~~~~~~~~

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 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'

 c) Build guest image for VNF to run.
    Most of the sample test cases in Yardstick are using a guest image called
    ``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
    following the commands below::

       sudo apt-get update && sudo apt-get install -y qemu-utils kpartx

    This image can be built using the following command in the directory where Yardstick is installed::

       export YARD_IMG_ARCH='amd64'
       sudo echo "Defaults env_keep += \'YARD_IMG_ARCH\'" >> /etc/sudoers
       sudo tools/yardstick-img-dpdk-modify tools/ubuntu-server-cloudimg-samplevnf-modify.sh

    for more details refer to chapter :doc:`04-installation`

    .. note::  VM should be build with static IP and should be accessible from yardstick host.

 c) OVS & DPDK version.
     - OVS 2.7 and DPDK 16.11.1 above version is supported

 d) Setup OVS/DPDK on host.
     Please refer to below link on how to setup `OVS-DPDK <http://docs.openvswitch.org/en/latest/intro/install/dpdk/>`_


OVS-DPDK Config pod.yaml describing Topology
++++++++++++++++++++++++++++++++++++++++++++

OVS-DPDK 2-Node setup
+++++++++++++++++++++

.. code-block:: console

                               +--------------------+
                               |                    |
                               |                    |
                               |        DUT         |
                               |       (VNF)        |
                               |                    |
                               +--------------------+
                               | virtio |  | virtio |
                               +--------+  +--------+
                                    ^          ^
                                    |          |
                                    |          |
                               +--------+  +--------+
                               | vHOST0 |  | vHOST1 |
  +----------+               +-------------------------+
  |          |               |       ^          ^      |
  |          |               |       |          |      |
  |          | (0)<----->(0) | ------           |      |
  |    TG1   |               |          SUT     |      |
  |          |               |       (ovs-dpdk) |      |
  |          | (n)<----->(n) |------------------       |
  +----------+               +-------------------------+
  trafficgen_1                          host


OVS-DPDK 3-Node setup - Correlated Traffic
++++++++++++++++++++++++++++++++++++++++++

.. code-block:: console

                               +--------------------+
                               |                    |
                               |                    |
                               |        DUT         |
                               |       (VNF)        |
                               |                    |
                               +--------------------+
                               | virtio |  | virtio |
                               +--------+  +--------+
                                    ^          ^
                                    |          |
                                    |          |
                               +--------+  +--------+
                               | vHOST0 |  | vHOST1 |
  +----------+               +-------------------------+          +------------+
  |          |               |       ^          ^      |          |            |
  |          |               |       |          |      |          |            |
  |          | (0)<----->(0) | ------           |      |          |    TG2     |
  |    TG1   |               |          SUT     |      |          |(UDP Replay)|
  |          |               |      (ovs-dpdk)  |      |          |            |
  |          | (n)<----->(n) |                  ------ |(n)<-->(n)|            |
  +----------+               +-------------------------+          +------------+
  trafficgen_1                          host                       trafficgen_2


Before executing Yardstick test cases, make sure that pod.yaml reflects the
topology and update all the required fields.

.. code-block:: console

  cp <yardstick>/etc/yardstick/nodes/standalone/trex_bm.yaml.sample /etc/yardstick/nodes/standalone/pod_trex.yaml
  cp <yardstick>/etc/yardstick/nodes/standalone/host_ovs.yaml /etc/yardstick/nodes/standalone/host_ovs.yaml

.. note:: Update all the required fields like ip, user, password, pcis, etc...

OVS-DPDK Config pod_trex.yaml
+++++++++++++++++++++++++++++

.. code-block:: YAML

    nodes:
    -
      name: trafficgen_1
      role: TrafficGen
      ip: 1.1.1.1
      user: root
      password: r00t
      interfaces:
          xe0:  # logical name from topology.yaml and vnfd.yaml
              vpci:      "0000:07:00.0"
              driver:    i40e # default kernel driver
              dpdk_port_num: 0
              local_ip: "152.16.100.20"
              netmask:   "255.255.255.0"
              local_mac: "00:00:00:00:00:01"
          xe1:  # logical name from topology.yaml and vnfd.yaml
              vpci:      "0000:07:00.1"
              driver:    i40e # default kernel driver
              dpdk_port_num: 1
              local_ip: "152.16.40.20"
              netmask:   "255.255.255.0"
              local_mac: "00:00.00:00:00:02"

OVS-DPDK Config host_ovs.yaml
+++++++++++++++++++++++++++++

.. code-block:: YAML

    nodes:
    -
       name: ovs_dpdk
       role: OvsDpdk
       ip: 192.168.100.101
       user: ""
       password: ""

ovs_dpdk testcase update:
``<yardstick>/samples/vnf_samples/nsut/vfw/tc_ovs_rfc2544_ipv4_1rule_1flow_64B_trex.yaml``

Update "contexts" section
'''''''''''''''''''''''''

.. code-block:: YAML

  contexts:
   - name: yardstick
     type: Node
     file: /etc/yardstick/nodes/standalone/pod_trex.yaml
   - type: StandaloneOvsDpdk
     name: yardstick
     file: /etc/yardstick/nodes/standalone/pod_ovs.yaml
     vm_deploy: True
     ovs_properties:
       version:
         ovs: 2.7.0
         dpdk: 16.11.1
       pmd_threads: 2
       ram:
         socket_0: 2048
         socket_1: 2048
       queues: 4
       vpath: "/usr/local"

     flavor:
       images: "/var/lib/libvirt/images/ubuntu.qcow2"
       ram: 4096
       extra_specs:
         hw:cpu_sockets: 1
         hw:cpu_cores: 6
         hw:cpu_threads: 2
       user: "" # update VM username
       password: "" # update password
     servers:
       vnf:
         network_ports:
           mgmt:
             cidr: '1.1.1.61/24'  # Update VM IP address, if static, <ip>/<mask> or if dynamic, <start of ip>/<mask>
           xe0:
             - uplink_0
           xe1:
             - downlink_0
     networks:
       uplink_0:
         phy_port: "0000:05:00.0"
         vpci: "0000:00:07.0"
         cidr: '152.16.100.10/24'
         gateway_ip: '152.16.100.20'
       downlink_0:
         phy_port: "0000:05:00.1"
         vpci: "0000:00:08.0"
         cidr: '152.16.40.10/24'
         gateway_ip: '152.16.100.20'


Network Service Benchmarking - OpenStack with SR-IOV support
------------------------------------------------------------

This section describes how to run a Sample VNF test case, using Heat context,
with SR-IOV. It also covers how to install OpenStack in Ubuntu 16.04, using
DevStack, with SR-IOV support.


Single node OpenStack setup with external TG
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: console

                                 +----------------------------+
                                 |OpenStack(DevStack)         |
                                 |                            |
                                 |   +--------------------+   |
                                 |   |sample-VNF VM       |   |
                                 |   |                    |   |
                                 |   |        DUT         |   |
                                 |   |       (VNF)        |   |
                                 |   |                    |   |
                                 |   +--------+  +--------+   |
                                 |   | VF NIC |  | VF NIC |   |
                                 |   +-----+--+--+----+---+   |
                                 |         ^          ^       |
                                 |         |          |       |
  +----------+                   +---------+----------+-------+
  |          |                   |        VF0        VF1      |
  |          |                   |         ^          ^       |
  |          |                   |         |   SUT    |       |
  |    TG    | (PF0)<----->(PF0) +---------+          |       |
  |          |                   |                    |       |
  |          | (PF1)<----->(PF1) +--------------------+       |
  |          |                   |                            |
  +----------+                   +----------------------------+
  trafficgen_1                                 host


Host pre-configuration
++++++++++++++++++++++

.. warning:: The following configuration requires sudo access to the system. Make
  sure that your user have the access.

Enable the Intel VT-d or AMD-Vi extension in the BIOS. Some system manufacturers
disable this extension by default.

Activate the Intel VT-d or AMD-Vi extension in the kernel by modifying the GRUB
config file ``/etc/default/grub``.

For the Intel platform:

.. code:: bash

  ...
  GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"
  ...

For the AMD platform:

.. code:: bash

  ...
  GRUB_CMDLINE_LINUX_DEFAULT="amd_iommu=on"
  ...

Update the grub configuration file and restart the system:

.. warning:: The following command will reboot the system.

.. code:: bash

  sudo update-grub
  sudo reboot

Make sure the extension has been enabled:

.. code:: bash

  sudo journalctl -b 0 | grep -e IOMMU -e DMAR

  Feb 06 14:50:14 hostname kernel: ACPI: DMAR 0x000000006C406000 0001E0 (v01 INTEL  S2600WF  00000001 INTL 20091013)
  Feb 06 14:50:14 hostname kernel: DMAR: IOMMU enabled
  Feb 06 14:50:14 hostname kernel: DMAR: Host address width 46
  Feb 06 14:50:14 hostname kernel: DMAR: DRHD base: 0x000000d37fc000 flags: 0x0
  Feb 06 14:50:14 hostname kernel: DMAR: dmar0: reg_base_addr d37fc000 ver 1:0 cap 8d2078c106f0466 ecap f020de
  Feb 06 14:50:14 hostname kernel: DMAR: DRHD base: 0x000000e0ffc000 flags: 0x0
  Feb 06 14:50:14 hostname kernel: DMAR: dmar1: reg_base_addr e0ffc000 ver 1:0 cap 8d2078c106f0466 ecap f020de
  Feb 06 14:50:14 hostname kernel: DMAR: DRHD base: 0x000000ee7fc000 flags: 0x0

Setup system proxy (if needed). Add the following configuration into the
``/etc/environment`` file:

.. note:: The proxy server name/port and IPs should be changed according to
  actual/current proxy configuration in the lab.

.. code:: bash

  export http_proxy=http://proxy.company.com:port
  export https_proxy=http://proxy.company.com:port
  export ftp_proxy=http://proxy.company.com:port
  export no_proxy=localhost,127.0.0.1,company.com,<IP-OF-HOST1>,<IP-OF-HOST2>,...
  export NO_PROXY=localhost,127.0.0.1,company.com,<IP-OF-HOST1>,<IP-OF-HOST2>,...

Upgrade the system:

.. code:: bash

  sudo -EH apt-get update
  sudo -EH apt-get upgrade
  sudo -EH apt-get dist-upgrade

Install dependencies needed for the DevStack

.. code:: bash

  sudo -EH apt-get install python
  sudo -EH apt-get install python-dev
  sudo -EH apt-get install python-pip

Setup SR-IOV ports on the host:

.. 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.

.. code:: bash

  sudo ip link set dev enp24s0f0 up
  sudo ip link set dev enp24s0f1 up
  sudo ip link set dev enp24s0f3 up

  # Create VFs on PF
  echo 2 | sudo tee /sys/class/net/enp24s0f0/device/sriov_numvfs
  echo 2 | sudo tee /sys/class/net/enp24s0f1/device/sriov_numvfs


DevStack installation
+++++++++++++++++++++

Use official `Devstack <https://docs.openstack.org/devstack/pike/>`_
documentation to install OpenStack on a host. Please note, that stable
``pike`` branch of devstack repo should be used during the installation.
The required `local.conf`` configuration file are described below.

DevStack configuration file:

.. note:: Update the devstack configuration file by replacing angluar brackets
  with a short description inside.

.. note:: Use ``lspci | grep Ether`` & ``lspci -n | grep <PCI ADDRESS>``
  commands to get device and vendor id of the virtual function (VF).

.. literalinclude:: code/single-devstack-local.conf
   :language: console

Start the devstack installation on a host.


TG host configuration
+++++++++++++++++++++

Yardstick automatically install and configure Trex traffic generator on TG
host based on provided POD file (see below). Anyway, it's recommended to check
the compatibility of the installed NIC on the TG server with software Trex using
the manual at https://trex-tgn.cisco.com/trex/doc/trex_manual.html.


Run the Sample VNF test case
++++++++++++++++++++++++++++

There is an example of Sample VNF test case ready to be executed in an
OpenStack environment with SR-IOV support: ``samples/vnf_samples/nsut/vfw/
tc_heat_sriov_external_rfc2544_ipv4_1rule_1flow_64B_trex.yaml``.

Install yardstick using `Install Yardstick (NSB Testing)`_ steps for OpenStack
context.

Create pod file for TG in the yardstick repo folder located in the yardstick
container:

.. note:: The ``ip``, ``user``, ``password`` and ``vpci`` fields show be  changed
  according to HW environment used for the testing. Use ``lshw -c network -businfo``
  command to get the PF PCI address for ``vpci`` field.

.. literalinclude:: code/single-yardstick-pod.conf
   :language: console

Run the Sample vFW RFC2544 SR-IOV TC (``samples/vnf_samples/nsut/vfw/
tc_heat_sriov_external_rfc2544_ipv4_1rule_1flow_64B_trex.yaml``) in the heat
context using steps described in `NS testing - using yardstick CLI`_ section.


Multi node OpenStack TG and VNF setup (two nodes)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: console

  +----------------------------+                   +----------------------------+
  |OpenStack(DevStack)         |                   |OpenStack(DevStack)         |
  |                            |                   |                            |
  |   +--------------------+   |                   |   +--------------------+   |
  |   |sample-VNF VM       |   |                   |   |sample-VNF VM       |   |
  |   |                    |   |                   |   |                    |   |
  |   |         TG         |   |                   |   |        DUT         |   |
  |   |    trafficgen_1    |   |                   |   |       (VNF)        |   |
  |   |                    |   |                   |   |                    |   |
  |   +--------+  +--------+   |                   |   +--------+  +--------+   |
  |   | VF NIC |  | VF NIC |   |                   |   | VF NIC |  | VF NIC |   |
  |   +----+---+--+----+---+   |                   |   +-----+--+--+----+---+   |
  |        ^           ^       |                   |         ^          ^       |
  |        |           |       |                   |         |          |       |
  +--------+-----------+-------+                   +---------+----------+-------+
  |       VF0         VF1      |                   |        VF0        VF1      |
  |        ^           ^       |                   |         ^          ^       |
  |        |    SUT2   |       |                   |         |   SUT1   |       |
  |        |           +-------+ (PF0)<----->(PF0) +---------+          |       |
  |        |                   |                   |                    |       |
  |        +-------------------+ (PF1)<----->(PF1) +--------------------+       |
  |                            |                   |                            |
  +----------------------------+                   +----------------------------+
           host2 (compute)                               host1 (controller)


Controller/Compute pre-configuration
++++++++++++++++++++++++++++++++++++

Pre-configuration of the controller and compute hosts are the same as
described in `Host pre-configuration`_ section. Follow the steps in the section.


DevStack configuration
++++++++++++++++++++++

Use official `Devstack <https://docs.openstack.org/devstack/pike/>`_
documentation to install OpenStack on a host. Please note, that stable
``pike`` branch of devstack repo should be used during the installation.
The required `local.conf`` configuration file are described below.

.. note:: Update the devstack configuration files by replacing angluar brackets
  with a short description inside.

.. note:: Use ``lspci | grep Ether`` & ``lspci -n | grep <PCI ADDRESS>``
  commands to get device and vendor id of the virtual function (VF).

DevStack configuration file for controller host:

.. literalinclude:: code/multi-devstack-controller-local.conf
   :language: console

DevStack configuration file for compute host:

.. literalinclude:: code/multi-devstack-compute-local.conf
   :language: console

Start the devstack installation on the controller and compute hosts.


Run the sample vFW TC
+++++++++++++++++++++

Install yardstick using `Install Yardstick (NSB Testing)`_ steps for OpenStack
context.

Run sample vFW RFC2544 SR-IOV TC (``samples/vnf_samples/nsut/vfw/
tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml``) in the heat
context using steps described in `NS testing - using yardstick CLI`_ section
and the following yardtick command line arguments:

.. code:: bash

  yardstick -d task start --task-args='{"provider": "sriov"}' \
  samples/vnf_samples/nsut/vfw/tc_heat_rfc2544_ipv4_1rule_1flow_64B_trex.yaml


Enabling other Traffic generator
--------------------------------

IxLoad
~~~~~~

1. Software needed: IxLoadAPI ``<IxLoadTclApi verson>Linux64.bin.tgz`` and
   ``<IxOS version>Linux64.bin.tar.gz`` (Download from ixia support site)
   Install - ``<IxLoadTclApi verson>Linux64.bin.tgz`` and
   ``<IxOS version>Linux64.bin.tar.gz``
   If the installation was not done inside the container, after installing
   the IXIA client, check ``/opt/ixia/ixload/<ver>/bin/ixloadpython`` and make
   sure you can run this cmd inside the yardstick container. Usually user is
   required to copy or link ``/opt/ixia/python/<ver>/bin/ixiapython`` to
   ``/usr/bin/ixiapython<ver>`` inside the container.

2. Update ``pod_ixia.yaml`` file with ixia details.

  .. code-block:: console

    cp <repo>/etc/yardstick/nodes/pod.yaml.nsb.sample.ixia etc/yardstick/nodes/pod_ixia.yaml

  Config ``pod_ixia.yaml``

  .. literalinclude:: code/pod_ixia.yaml
     :language: console

  for sriov/ovs_dpdk pod files, please refer to above Standalone Virtualization for ovs-dpdk/sriov configuration

3. Start IxOS TCL Server (Install 'Ixia IxExplorer IxOS <version>')
   You will also need to configure the IxLoad machine to start the IXIA
   IxosTclServer. This can be started like so:

   * Connect to the IxLoad machine using RDP
   * Go to:
     ``Start->Programs->Ixia->IxOS->IxOS 8.01-GA-Patch1->Ixia Tcl Server IxOS 8.01-GA-Patch1``
     or
     ``"C:\Program Files (x86)\Ixia\IxOS\8.01-GA-Patch1\ixTclServer.exe"``

4. Create a folder ``Results`` in c:\ and share the folder on the network.

5. Execute testcase in samplevnf folder e.g.
   ``<repo>/samples/vnf_samples/nsut/vfw/tc_baremetal_http_ixload_1b_Requests-65000_Concurrency.yaml``

IxNetwork
~~~~~~~~~

IxNetwork testcases use IxNetwork API Python Bindings module, which is
installed as part of the requirements of the project.

1. Update ``pod_ixia.yaml`` file with ixia details.

  .. code-block:: console

    cp <repo>/etc/yardstick/nodes/pod.yaml.nsb.sample.ixia etc/yardstick/nodes/pod_ixia.yaml

  Config pod_ixia.yaml

  .. literalinclude:: code/pod_ixia.yaml
     :language: console

  for sriov/ovs_dpdk pod files, please refer to above Standalone Virtualization for ovs-dpdk/sriov configuration

2. Start IxNetwork TCL Server
   You will also need to configure the IxNetwork machine to start the IXIA
   IxNetworkTclServer. This can be started like so:

    * Connect to the IxNetwork machine using RDP
    * Go to:
      ``Start->Programs->Ixia->IxNetwork->IxNetwork 7.21.893.14 GA->IxNetworkTclServer``
      (or ``IxNetworkApiServer``)

3. Execute testcase in samplevnf folder e.g.
   ``<repo>/samples/vnf_samples/nsut/vfw/tc_baremetal_rfc2544_ipv4_1rule_1flow_64B_ixia.yaml``

Spirent Landslide
-----------------

In order to use Spirent Landslide for vEPC testcases, some dependencies have
to be preinstalled and properly configured.

- Java

    32-bit Java installation is required for the Spirent Landslide TCL API.

    | ``$ sudo apt-get install openjdk-8-jdk:i386``

    .. important::
      Make sure ``LD_LIBRARY_PATH`` is pointing to 32-bit JRE. For more details
      check `Linux Troubleshooting <http://TAS_HOST_IP/tclapiinstall.html#trouble>`
      section of installation instructions.

- LsApi (Tcl API module)

    Follow Landslide documentation for detailed instructions on Linux
    installation of Tcl API and its dependencies
    ``http://TAS_HOST_IP/tclapiinstall.html``.
    For working with LsApi Python wrapper only steps 1-5 are required.

    .. note:: After installation make sure your API home path is included in
      ``PYTHONPATH`` environment variable.

    .. important::
    The current version of LsApi module has an issue with reading LD_LIBRARY_PATH.
    For LsApi module to initialize correctly following lines (184-186) in
    lsapi.py

    .. code-block:: python

        ldpath = os.environ.get('LD_LIBRARY_PATH', '')
        if ldpath == '':
         environ['LD_LIBRARY_PATH'] = environ['LD_LIBRARY_PATH'] + ':' + ldpath

    should be changed to:

    .. code-block:: python

        ldpath = os.environ.get('LD_LIBRARY_PATH', '')
        if not ldpath == '':
               environ['LD_LIBRARY_PATH'] = environ['LD_LIBRARY_PATH'] + ':' + ldpath

.. note:: The Spirent landslide TCL software package needs to be updated in case
  the user upgrades to a new version of Spirent landslide software.