1 # Copyright (c) 2019 Viosoft Corporation
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 from yardstick.network_services.vnf_generic.vnf.sample_vnf import \
20 LOG = logging.getLogger(__name__)
23 class VppSetupEnvHelper(DpdkVnfSetupEnvHelper):
25 CFG_CONFIG = "/etc/vpp/startup.conf"
29 VAT_BIN_NAME = 'vpp_api_test'
31 def __init__(self, vnfd_helper, ssh_helper, scenario_helper):
32 super(VppSetupEnvHelper, self).__init__(vnfd_helper, ssh_helper,
37 self.ssh_helper.execute(
38 'service {name} stop'.format(name=self.APP_NAME))
41 'Failed to stop service {name}'.format(name=self.APP_NAME))
46 def start_vpp_service(self):
48 self.ssh_helper.execute(
49 'service {name} restart'.format(name=self.APP_NAME))
52 'Failed to start service {name}'.format(name=self.APP_NAME))
54 def _update_vnfd_helper(self, additional_data, iface_key=None):
55 for k, v in additional_data.items():
57 if isinstance(v, dict) and k in self.vnfd_helper:
58 self.vnfd_helper[k].update(v)
60 self.vnfd_helper[k] = v
63 dict) and k in self.vnfd_helper.find_virtual_interface(
65 self.vnfd_helper.find_virtual_interface(ifname=iface_key)[
68 self.vnfd_helper.find_virtual_interface(ifname=iface_key)[
71 def get_value_by_interface_key(self, interface, key):
73 return self.vnfd_helper.find_virtual_interface(
74 ifname=interface).get(key)
75 except (KeyError, ValueError):