1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
14 """VPP util library"""
15 from resources.libraries.python.ssh import SSH
18 class VPPUtil(object):
19 """General class for any VPP related methods/functions."""
22 def show_vpp_settings(node, *additional_cmds):
23 """Print default VPP settings. In case others are needed, can be
24 accepted as next parameters (each setting one parameter), preferably
27 :param node: VPP node.
28 :param additional_cmds: Additional commands that the vpp should print
31 :type additional_cmds: tuple
33 def_setting_tb_displayed = {
34 'IPv6 FIB': 'ip6 fib',
36 'Interface IP': 'int addr',
43 for cmd in additional_cmds:
44 def_setting_tb_displayed['Custom Setting: {}'.format(cmd)] = cmd
48 for key, value in def_setting_tb_displayed.iteritems():
49 (_, stdout, _) = ssh.exec_command_sudo('vppctl sh {}'.format(value))
50 print("{} : {} \n".format(key, value))