Merge "dpdk: Support of DPDK16.07-rc5 and newer"
[vswitchperf.git] / tools / functions.py
1 # Copyright 2016 Intel Corporation.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #   http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 """Various helper functions
16 """
17
18 from conf import settings
19
20 #
21 # Support functions
22 #
23
24 def settings_update_paths():
25     """ Configure paths to OVS and DPDK based on VSWITCH and VNF values
26     """
27     # set dpdk and ovs paths accorfing to VNF and VSWITCH
28     if settings.getValue('VSWITCH').endswith('Vanilla'):
29         # settings paths for Vanilla
30         settings.setValue('OVS_DIR', (settings.getValue('OVS_DIR_VANILLA')))
31     elif settings.getValue('VSWITCH').endswith('Vhost'):
32         if settings.getValue('VNF').endswith('Cuse'):
33             # settings paths for Cuse
34             settings.setValue('RTE_SDK', (settings.getValue('RTE_SDK_CUSE')))
35             settings.setValue('OVS_DIR', (settings.getValue('OVS_DIR_CUSE')))
36         else:
37             # settings paths for VhostUser
38             settings.setValue('RTE_SDK', (settings.getValue('RTE_SDK_USER')))
39             settings.setValue('OVS_DIR', (settings.getValue('OVS_DIR_USER')))
40     else:
41         # default - set to VHOST USER but can be changed during enhancement
42         settings.setValue('RTE_SDK', (settings.getValue('RTE_SDK_USER')))
43         settings.setValue('OVS_DIR', (settings.getValue('OVS_DIR_USER')))