Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
VPP-1525: additional fixes for strings in Japi
[vpp.git]
/
extras
/
vpp_config
/
vpp_config.py
diff --git
a/extras/vpp_config/vpp_config.py
b/extras/vpp_config/vpp_config.py
index
69e7de7
..
145bf4e
100755
(executable)
--- a/
extras/vpp_config/vpp_config.py
+++ b/
extras/vpp_config/vpp_config.py
@@
-323,6
+323,7
@@
def autoconfig_apply(ask_questions=True):
# Everything is configured start vpp
VPPUtil.start(node)
# Everything is configured start vpp
VPPUtil.start(node)
+
def autoconfig_dryrun(ask_questions=True):
"""
Execute the dryrun function.
def autoconfig_dryrun(ask_questions=True):
"""
Execute the dryrun function.
@@
-426,8
+427,14
@@
def autoconfig_install():
question = "Do you want to install VPP [Y/n]? "
answer = autoconfig_yn(question, 'y')
if answer == 'y':
question = "Do you want to install VPP [Y/n]? "
answer = autoconfig_yn(question, 'y')
if answer == 'y':
+ question = "Do you want to install the release version [Y/n]? "
+ answer = autoconfig_yn(question, 'y')
+ if answer == 'y':
+ branch = 'release'
+ else:
+ branch = 'master'
logger.setLevel(logging.INFO)
logger.setLevel(logging.INFO)
- vutil.install_vpp(node)
+ vutil.install_vpp(node
, branch
)
# Set the logging level back
logger.setLevel(logging.ERROR)
# Set the logging level back
logger.setLevel(logging.ERROR)
@@
-463,14
+470,16
@@
def autoconfig_ipv4_setup():
acfg.ipv4_interface_setup()
acfg.ipv4_interface_setup()
-def autoconfig_create_vm():
+def autoconfig_create_
iperf_
vm():
"""
Setup IPv4 interfaces
"""
acfg = AutoConfig(rootdir, VPP_AUTO_CONFIGURATION_FILE)
"""
Setup IPv4 interfaces
"""
acfg = AutoConfig(rootdir, VPP_AUTO_CONFIGURATION_FILE)
- acfg.create_and_bridge_virtual_interfaces()
+ acfg.destroy_iperf_vm('iperf-server')
+ acfg.create_and_bridge_iperf_virtual_interface()
+ acfg.create_iperf_vm('iperf-server')
def autoconfig_not_implemented():
def autoconfig_not_implemented():
@@
-490,13
+499,9
@@
def autoconfig_basic_test_menu():
basic_menu_text = '\nWhat would you like to do?\n\n\
1) List/Create Simple IPv4 Setup\n\
basic_menu_text = '\nWhat would you like to do?\n\n\
1) List/Create Simple IPv4 Setup\n\
+2) Create an iperf VM and Connect to VPP an interface\n\
9 or q) Back to main menu.'
9 or q) Back to main menu.'
- # 1) List/Create Simple IPv4 Setup\n\
- # 2) List/Create Create VM and Connect to VPP interfaces\n\
- # 9 or q) Back to main menu.'
-
-
print "{}".format(basic_menu_text)
input_valid = False
print "{}".format(basic_menu_text)
input_valid = False
@@
-534,8
+539,8
@@
def autoconfig_basic_test():
answer = autoconfig_basic_test_menu()
if answer == '1':
autoconfig_ipv4_setup()
answer = autoconfig_basic_test_menu()
if answer == '1':
autoconfig_ipv4_setup()
-
#
elif answer == '2':
-
# autoconfig_create
_vm()
+ elif answer == '2':
+
autoconfig_create_iperf
_vm()
elif answer == '9' or answer == 'q':
return
else:
elif answer == '9' or answer == 'q':
return
else:
@@
-550,12
+555,10
@@
def autoconfig_main_menu():
main_menu_text = '\nWhat would you like to do?\n\n\
1) Show basic system information\n\
main_menu_text = '\nWhat would you like to do?\n\n\
1) Show basic system information\n\
-2) Dry Run (Will save the configuration files in {}/vpp/vpp-config/dryrun for inspection)\n\
- and user input in {}/vpp/vpp-config/configs/auto-config.yaml\n\
+2) Dry Run (Saves the configuration files in {}/vpp/vpp-config/dryrun.\n\
3) Full configuration (WARNING: This will change the system configuration)\n\
4) List/Install/Uninstall VPP.\n\
3) Full configuration (WARNING: This will change the system configuration)\n\
4) List/Install/Uninstall VPP.\n\
-5) Execute some basic tests.\n\
-9 or q) Quit'.format(rootdir, rootdir)
+q) Quit'.format(rootdir, rootdir)
# 5) Dry Run from {}/vpp/vpp-config/auto-config.yaml (will not ask questions).\n\
# 6) Install QEMU patch (Needed when running openstack).\n\
# 5) Dry Run from {}/vpp/vpp-config/auto-config.yaml (will not ask questions).\n\
# 6) Install QEMU patch (Needed when running openstack).\n\
@@
-569,14
+572,12
@@
def autoconfig_main_menu():
if len(answer) > 1:
print "Please enter only 1 character."
continue
if len(answer) > 1:
print "Please enter only 1 character."
continue
- if re.findall(r'[Qq1-
79
]', answer):
+ if re.findall(r'[Qq1-
4
]', answer):
input_valid = True
answer = answer[0].lower()
else:
input_valid = True
answer = answer[0].lower()
else:
- print "Please enter a character between 1 and
5 or 9
."
+ print "Please enter a character between 1 and
4 or q
."
- if answer == '9':
- answer = 'q'
return answer
return answer
@@
-600,9
+601,7
@@
def autoconfig_main():
autoconfig_apply()
elif answer == '4':
autoconfig_install()
autoconfig_apply()
elif answer == '4':
autoconfig_install()
- elif answer == '5':
- autoconfig_basic_test()
- elif answer == '9' or answer == 'q':
+ elif answer == 'q':
return
else:
autoconfig_not_implemented()
return
else:
autoconfig_not_implemented()
@@
-618,8
+617,6
@@
def autoconfig_setup(ask_questions=True):
global rootdir
global rootdir
- logging.basicConfig(level=logging.ERROR)
-
distro = VPPUtil.get_linux_distro()
if distro[0] == 'Ubuntu':
rootdir = '/usr/local'
distro = VPPUtil.get_linux_distro()
if distro[0] == 'Ubuntu':
rootdir = '/usr/local'
@@
-659,7
+656,14
@@
def autoconfig_setup(ask_questions=True):
(os.path.isfile(VPP_REAL_GRUB_FILE) is True):
autoconfig_cp(node, VPP_REAL_GRUB_FILE, '{}'.format(rootdir + VPP_GRUB_FILE))
(os.path.isfile(VPP_REAL_GRUB_FILE) is True):
autoconfig_cp(node, VPP_REAL_GRUB_FILE, '{}'.format(rootdir + VPP_GRUB_FILE))
+ # Be sure the uio_pci_generic driver is installed
+ cmd = 'modprobe uio_pci_generic'
+ (ret, stdout, stderr) = VPPUtil.exec_command(cmd)
+ if ret != 0:
+ logging.warning('{} failed on node {} {}'. format(cmd, node['host'], stderr))
+
+# noinspection PyUnresolvedReferences
def execute_with_args(args):
"""
Execute the configuration utility with agruments.
def execute_with_args(args):
"""
Execute the configuration utility with agruments.
@@
-692,9
+696,16
@@
def config_main():
if not os.geteuid() == 0:
sys.exit('\nPlease run the VPP Configuration Utility as root.')
if not os.geteuid() == 0:
sys.exit('\nPlease run the VPP Configuration Utility as root.')
+ if len(sys.argv) > 1 and ((sys.argv[1] == '-d') or (sys.argv[1] == '--debug')):
+ logging.basicConfig(level=logging.DEBUG)
+ else:
+ logging.basicConfig(level=logging.ERROR)
+
# If no arguments were entered, ask the user questions to get the main parameters
if len(sys.argv) == 1:
# If no arguments were entered, ask the user questions to get the main parameters
if len(sys.argv) == 1:
- # Main menu
+ autoconfig_main()
+ return
+ elif len(sys.argv) == 2 and (sys.argv[1] == '-d' or sys.argv[1] == '--debug'):
autoconfig_main()
return
autoconfig_main()
return
@@
-717,5
+728,4
@@
in an interactive mode'
if __name__ == '__main__':
if __name__ == '__main__':
-
config_main()
config_main()