| 359 | | def directive_menu previous = nil, output = nil, number_directives = 1 |
|---|
| 360 | | puts " HefeWeizen Main Directive Menu" |
|---|
| 361 | | puts "-------------------------------------------------------------------------------" |
|---|
| 362 | | puts "M - Main Menu S - Show Statistics T - Top program Q - Quit" |
|---|
| 363 | | puts "" |
|---|
| 364 | | puts "D - dynamic directives!" |
|---|
| 365 | | puts "N - set number of directives to copy. currently: #{number_directives}" |
|---|
| 366 | | puts "C - clear systems" |
|---|
| 367 | | puts "" |
|---|
| 368 | | puts "1 - ping from Coronation to Gnaraloo" |
|---|
| 369 | | puts "2 - payload from Coronation to Gnaraloo" |
|---|
| 370 | | puts "" |
|---|
| 371 | | puts "8 - ping from Coronation to webswell connect" |
|---|
| 372 | | puts "9 - payload from Coronation to webswell connect" |
|---|
| 373 | | puts "-------------------------------------------------------------------------------" |
|---|
| 374 | | puts "please select ..." |
|---|
| 375 | | if !previous.nil? then |
|---|
| 376 | | puts "previous selection '#{previous}'" |
|---|
| 377 | | if !output.nil? then |
|---|
| 378 | | puts "==========================output==================================" |
|---|
| 379 | | puts output |
|---|
| 380 | | puts "==================================================================" |
|---|
| 381 | | end |
|---|
| 382 | | end |
|---|
| 383 | | end |
|---|
| 384 | | |
|---|
| 395 | | when "M" |
|---|
| 396 | | return |
|---|
| 397 | | when "D" |
|---|
| 398 | | |
|---|
| 399 | | party_path, party_name, cpa_path = get_party_and_cpa |
|---|
| 400 | | system "clear" |
|---|
| 401 | | |
|---|
| 402 | | cpa_filename = cpa_path |
|---|
| 403 | | |
|---|
| 404 | | require "#{@config['LIB_DIR']}/hefeweizen_library_cpa" |
|---|
| 405 | | cpa = HefeWeizen::HefeWeizenLibrary::CPA.create(cpa_filename, @config) |
|---|
| 406 | | |
|---|
| 407 | | party_identities = load_identities party_path |
|---|
| 408 | | |
|---|
| 409 | | cpas_info = [cpa.setup_all_ebMS_header_infos( cpa.id, party_name, party_identities )] |
|---|
| 410 | | cpas_info.first['cpa_id'] = cpa.id |
|---|
| 411 | | number_directives, resend_interval = work_directive_dynamic_menu party_name, cpas_info, number_directives, payload_size, resend_interval |
|---|
| 412 | | when "S" |
|---|
| 413 | | output = %x(sh ./run-statistics.sh Coronation Gnaraloo) |
|---|
| 414 | | when "1" |
|---|
| 415 | | command = "sh ./run-copy-ping-directive-n.sh #{number_directives || 1} &" |
|---|
| 416 | | system command |
|---|
| 417 | | output = "sent command: #{command}" |
|---|
| 418 | | when "2" |
|---|
| 419 | | command = "sh ./run-copy-directive-n.sh #{number_directives || 1} &" |
|---|
| 420 | | system command |
|---|
| 421 | | output = "sent command: #{command}" |
|---|
| 422 | | when "8" |
|---|
| 423 | | command = "sh ./run-copy-ping-gnaraloo-wc-directive-n.sh #{number_directives || 1} &" |
|---|
| 424 | | system command |
|---|
| 425 | | output = "sent command: #{command}" |
|---|
| 426 | | when "9" |
|---|
| 427 | | command = "sh ./run-copy-gnaraloo-wc-directive-n.sh #{number_directives || 1} &" |
|---|
| 428 | | system command |
|---|
| 429 | | output = "sent command: #{command}" |
|---|
| 430 | | when "N" |
|---|
| 431 | | puts "Enter value: " |
|---|
| 432 | | begin |
|---|
| 433 | | value = gets.chomp.upcase.to_i |
|---|
| 434 | | number_directives = value |
|---|
| 435 | | rescue |
|---|
| 436 | | output "Unable to understand. Set number to 1" |
|---|
| 437 | | number_directives = 1 |
|---|
| 438 | | end |
|---|
| 439 | | when "C" |
|---|
| 440 | | command = "sh ./run-clear-system.sh" |
|---|
| 441 | | system command |
|---|
| 442 | | output = "sent command: #{command}" |
|---|
| 443 | | when "T" |
|---|
| 444 | | system "top -d 0.7" |
|---|
| 445 | | output = "back" |
|---|
| | 481 | when "P" |
|---|
| | 482 | number_directives = 1 |
|---|
| | 483 | resend_interval = 0 |
|---|
| | 484 | payload_size = "small" |
|---|
| | 485 | |
|---|
| | 486 | party_path, party_name, cpa_path = get_party_and_cpa |
|---|
| | 487 | system "clear" |
|---|
| | 488 | |
|---|
| | 489 | cpa_filename = cpa_path |
|---|
| | 490 | require "#{@config['LIB_DIR']}/hefeweizen_library_cpa" |
|---|
| | 491 | cpa = HefeWeizen::HefeWeizenLibrary::CPA.create(cpa_filename, @config) |
|---|
| | 492 | |
|---|
| | 493 | party_identities = load_identities party_path |
|---|
| | 494 | |
|---|
| | 495 | cpas_info = [cpa.setup_all_ebMS_header_infos( cpa.id, party_name, party_identities )] |
|---|
| | 496 | cpas_info.first['cpa_id'] = cpa.id |
|---|
| | 497 | number_directives, resend_interval = work_directive_dynamic_menu party_name, cpas_info, number_directives, payload_size, resend_interval |
|---|