Compare commits

..

3 Commits

Author SHA1 Message Date
Cristi Ene a670d9d15e add node for all users 2021-10-07 11:43:20 +03:00
Cristi Ene 8dc145875d update install witn nvm 2021-10-07 11:30:58 +03:00
Sergiu Toma 4c797f915e test vagrant 2021-10-07 10:31:35 +03:00
52 changed files with 406 additions and 1164 deletions

6
.gitignore vendored
View File

@ -1,6 +1,6 @@
node_modules
.vscode
config/default.toml
certs
logs/*
!logs
!logs
config/default.toml
certs

View File

@ -0,0 +1 @@
{"dependencies":[["log4r",[">= 0"]],["concurrent-ruby",["~> 1.0"]],["i18n",[">= 0"]],["micromachine",[">= 2","< 4"]],["vagrant-vbguest",["= 0.30.0"]]],"checksum":"11b1b35cf79113cc49e78dfeea4aabc6746d1df7877ec4f5145f0b7b96ad3af1","vagrant_version":"2.2.18"}

View File

@ -0,0 +1 @@
1633592300

View File

@ -0,0 +1 @@
{"name":"ubuntu/xenial64","version":"20210804.0.0","provider":"virtualbox","directory":"boxes/ubuntu-VAGRANTSLASH-xenial64/20210804.0.0/virtualbox"}

View File

@ -0,0 +1 @@
501

View File

@ -0,0 +1 @@
f5f76f97-2f67-49df-83e1-835cbb87625e

View File

@ -0,0 +1 @@
cf5295e73d3d40e6a3647df3a5a41f89

View File

@ -0,0 +1 @@
/Users/cristi/work/git-projects/LINX/linx-simulator2

View File

@ -0,0 +1,9 @@
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end

View File

@ -6,6 +6,7 @@ RUN apt-get install -y build-essential
RUN apt-get install -y curl
RUN apt-get install -y python-minimal
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash
RUN apt-get install -y nodejs
WORKDIR /simulator

30
Vagrantfile vendored
View File

@ -12,7 +12,7 @@ Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "bento/ubuntu-16.04"
config.vm.box = "ubuntu/xenial64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
@ -47,6 +47,7 @@ Vagrant.configure("2") do |config|
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
config.vm.synced_folder ".", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
@ -55,14 +56,14 @@ Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when booting the machine
# vb.gui = true
vb.customize [
"modifyvm", :id,
"--audio", "coreaudio",
"--audiocontroller", "hda"
]
# vb.customize [
# "modifyvm", :id,
# "--audio", "coreaudio",
# "--audiocontroller", "hda"
# ]
# Customize the amount of memory on the VM:
vb.memory = "1024"
vb.memory = "2024"
end
#
# View the documentation for the provider you are using for more
@ -75,5 +76,18 @@ Vagrant.configure("2") do |config|
# apt-get update
# apt-get install -y apache2
# SHELL
# config.vm.provision "shell", inline: <<-SHELL
# sudo apt-get update
# sudo apt-get -y install dkms
# #https://wiki.ubuntu.com/Audio/UpgradingAlsa/DKMS
# wget http://ppa.launchpad.net/ubuntu-audio-dev/alsa-daily/ubuntu/pool/main/o/oem-audio-hda-daily-dkms/oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo dpkg -i oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# rm oem-audio-hda-daily-dkms_0.201509251532~ubuntu14.04.1_all.deb
# sudo apt-get -y install python-dev ipython python-numpy python-matplotlib python-scipy cython alsa-utils paman
# sudo usermod -a -G audio vagrant
# SHELL
config.vm.provision "shell", path: "install.sh", privileged: true
end
end

View File

@ -1,440 +0,0 @@
[elogs]
name = 'dev'
[api]
port = ''
host = 'node.dev.linx.safemobile.com/api'
use_secure = true
accept_untrusted_certs = true
[settings]
max_fails = 3
send_group_monitoring_before_each_call = 'false'
gps_report_interval = ''
gps_min_interval = 1000
gps_max_interval = 10000
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
delay_between_clients = 500
testing_duration = 240 # seconds
# group 1 / 1 send / 10 listen
[[assets]]
asset_id = 7516
group_id = 2561
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7517
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7518
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7519
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7520
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7521
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7522
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7523
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7524
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7525
group_id = 2561
generate_voice = false
[[assets]]
asset_id = 7526
group_id = 2561
generate_voice = false
# group 2 / 1 send / 10 listen
[[assets]]
asset_id = 7536
group_id = 2560
generate_voice = true
[[assets]]
asset_id = 7537
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7538
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7539
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7540
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7541
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7542
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7543
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7544
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7545
group_id = 2560
generate_voice = false
[[assets]]
asset_id = 7546
group_id = 2560
generate_voice = false
# group 3 / 1 send / 10 listen
[[assets]]
asset_id = 7556
group_id = 2559
generate_voice = true
[[assets]]
asset_id = 7557
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7558
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7559
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7560
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7561
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7562
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7563
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7564
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7565
group_id = 2559
generate_voice = false
[[assets]]
asset_id = 7566
group_id = 2559
generate_voice = false
# group 4 / 1 send / 10 listen
[[assets]]
asset_id = 7576
group_id = 2558
generate_voice = true
[[assets]]
asset_id = 7577
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7578
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7579
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7580
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7581
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7582
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7583
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7584
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7585
group_id = 2558
generate_voice = false
[[assets]]
asset_id = 7586
group_id = 2558
generate_voice = false
# group 5 / 1 send / 10 listen
# group 6 / 1 send / 10 listen
# group 7 / 1 send / 10 listen
# group 8 / 1 send / 10 listen
# group 9 / 1 send / 10 listen
# group 10 / 1 send / 10 listen
[[assets]]
asset_id = 7715
group_id = 2552
generate_voice = true
[[assets]]
asset_id = 7714
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7713
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7712
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7711
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7710
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7709
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7708
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7707
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7706
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7705
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7704
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7703
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7702
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7701
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7700
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7699
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7698
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7697
group_id = 2552
generate_voice = false
[[assets]]
asset_id = 7696
group_id = 2552
generate_voice = false
[sounds]
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']

View File

@ -1,28 +0,0 @@
[elogs]
name = 'dev'
[api]
port = ''
host = 'node.dev.linx.safemobile.com/api'
use_secure = true
accept_untrusted_certs = true
[settings]
max_fails = 3
send_group_monitoring_before_each_call = 'false'
gps_report_interval = ''
gps_min_interval = 500
gps_max_interval = 1000
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
delay_between_clients = 500
testing_duration = 10 # seconds
[[assets]]
asset_id = 60
group_id = 1
generate_voice = true
generate_gps = true
[sounds]
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']

View File

@ -1,440 +1,53 @@
[mumble]
port = '5668'
host = 'dev.linx.safemobile.com'
[hub]
address = 'https://hub.dev.linx.safemobile.com/'
[elogs]
name = 'dev'
[api]
port = ''
host = 'node.dev.linx.safemobile.com/api'
host = 'dev.linx.safemobile.com/api'
use_secure = true
accept_untrusted_certs = true
[settings]
max_fails = 3
send_group_monitoring_before_each_call = 'false'
gps_report_interval = ''
gps_min_interval = 1000
gps_max_interval = 10000
send_voice = true
send_gps = true
gps_report_interval = 10000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
delay_between_clients = 500
testing_duration = 240 # seconds
# group 1 / 1 send / 10 listen
[[assets]]
asset_id = 7516
group_id = 2561
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7517
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7518
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7519
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7520
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7521
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7522
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7523
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7524
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7525
group_id = 2561
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7526
group_id = 2561
generate_voice = false
generate_gps = true
# group 2 / 1 send / 10 listen
[[assets]]
asset_id = 7536
group_id = 2560
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7537
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7538
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7539
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7540
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7541
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7542
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7543
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7544
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7545
group_id = 2560
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7546
group_id = 2560
generate_voice = false
generate_gps = true
# group 3 / 1 send / 10 listen
[[assets]]
asset_id = 7556
group_id = 2559
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7557
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7558
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7559
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7560
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7561
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7562
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7563
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7564
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7565
group_id = 2559
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7566
group_id = 2559
generate_voice = false
generate_gps = true
# group 4 / 1 send / 10 listen
[[assets]]
asset_id = 7576
group_id = 2558
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7577
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7578
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7579
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7580
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7581
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7582
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7583
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7584
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7585
group_id = 2558
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7586
group_id = 2558
generate_voice = false
generate_gps = true
# group 5 / 1 send / 10 listen
# group 6 / 1 send / 10 listen
# group 7 / 1 send / 10 listen
# group 8 / 1 send / 10 listen
# group 9 / 1 send / 10 listen
# group 10 / 1 send / 10 listen
[[assets]]
asset_id = 7715
group_id = 2552
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 7714
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7713
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7712
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7711
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7710
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7709
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7708
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7707
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7706
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7705
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7704
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7703
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7702
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7701
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7700
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7699
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7698
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7697
group_id = 2552
generate_voice = false
generate_gps = true
[[assets]]
asset_id = 7696
group_id = 2552
generate_voice = false
generate_gps = true
delay_between_clients = 300
testing_duration = 15 # seconds
[assets]
#ids = [ 8089 ]
ids = [ 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098 ]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108
#]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108
#]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108,
# 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118,
# 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128
#]
[sounds]
#sound = 'sound.mp3'
#sound = 'Donald Trump Sings I Will Survive (64 kbps).mp3'
#sounds_total_number = 20
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']

View File

@ -17,50 +17,62 @@ accept_untrusted_certs = true
[settings]
max_fails = 3
send_voice = true
send_gps = false
send_gps = true
gps_report_interval = 10000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
delay_between_clients = 300
testing_duration = 6000 # seconds
testing_period = 1
[assets]
#ids = [ 5496 ]
#VOICE and GPS Stag
#ids = [ 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505 ]
#ids = [ 5483 ]
#ids = [
# 5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505,
# 5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515
#ids = [
# 5482,5483,5484,5485,5486,5487,5488,5489,5490,5491
#]
ids = [
5496, 5497, 5498, 5499, 5500, 5501, 5502, 5503, 5504, 5505,
5506, 5507, 5508, 5509, 5510, 5511, 5512, 5513, 5514, 5515,
5516, 5517, 5518, 5519, 5520, 5521, 5522, 5523, 5524, 5525,
5526, 5527, 5528, 5529, 5530, 5531, 5532, 5533, 5534, 5535
ids = [
5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,
5492,5493,5494,5495,5496,5497,5498,5499,5500,5501
]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108
# 5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,
# 5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,
# 5502,5503,5504,5505,5506,5507,5508,5509,5510,5511
#]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108
# 5482,5483,5484,5485,5486,5487,5488,5489,5490,5491,
# 5492,5493,5494,5495,5496,5497,5498,5499,5500,5501,
# 5502,5503,5504,5505,5506,5507,5508,5509,5510,5511,
# 5512,5513,5514,5515,5516,5517,5518,5519,5520,5521
#]
#ids = [
# 8089, 8090, 8091, 8092, 8093, 8094, 8095, 8096, 8097, 8098,
# 8099, 8100, 8101, 8102, 8103, 8104, 8105, 8106, 8107, 8108,
# 8109, 8110, 8111, 8112, 8113, 8114, 8115, 8116, 8117, 8118,
# 8119, 8120, 8121, 8122, 8123, 8124, 8125, 8126, 8127, 8128
#ids = [
# 5435,5436,5437,5438,5439,
# 5440,5441,5442,5443,5444
# 5445,5446,5447,5448,5449,
# 5450,5451,5452,5453,5454,
# 5455,5456,5457,5458,5459,
# 5460,5461,5462,5463,5464,
# 5465,5466,5467,5468,5469
#]
#ids = [
# 5435,5436,5437,5438,5439,
# 5440,5441,5442,5443,5444,
# 5445,5446,5447,5448,5449,
# 5450,5451,5452,5453,5454,
# 5455,5456,5457,5458,5459,
# 5460,5461,5462,5463,5464,
# 5465,5466,5467,5468,5469
#]
[sounds]
#sound = 'sound.mp3'
#sound = 'Donald Trump Sings I Will Survive (64 kbps).mp3'
#sounds_total_number = 20
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']
#sound = 'Donald Trump Sings Without Me by Eminem.mp3'
sound = 'poke.mp3'
sounds_total_number = 20

View File

@ -1,16 +1,16 @@
[mumble]
port = '5668'
host = 'dev.linx.safemobile.com'
host = 'presgold.linx.safemobile.com'
[hub]
address = 'https://hub.dev.linx.safemobile.com/'
address = 'https://hub.presgold.linx.safemobile.com/'
[elogs]
name = 'dev'
name = 'stage'
[api]
port = ''
host = 'dev.linx.safemobile.com/api'
host = 'presgold.linx.safemobile.com/api/secure'
use_secure = true
accept_untrusted_certs = true
@ -18,21 +18,135 @@ accept_untrusted_certs = true
max_fails = 3
send_voice = true
send_gps = true
send_group_monitoring_before_each_call = false
gps_report_interval = 10000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126
delay_between_clients = 300
testing_duration = 600 # seconds
[assets]
ids = [ 2776 ]
#VOICE and GPS Stage
# ids = [
# 65,1125
# ]
ids = [
asset_id_1, asset_id_2, asset_id_3
]
# VOICE and GPS Presgold
# ids = [
# 2164
# 2164,2165,2166,2167,2168,2169,2170,2171,2172,2173
# 2174,2175,2176,2177,2178,2179,2180,2181,2182,2183,
# 2184,2185,2186,2187,2188,2189,2190,2191,2192,2193,
# 2194,2195,2196,2197,2198,2199,2200,2201,2202,2203,
# 2204,2205,2206,2207,2208,2209,2210,2211,2212,2213,
# 2214,2215,2216,2217,2218,2219,2220,2221,2222,2223,
# 2224,2225,2226,2227,2228,2229,2230,2231,2232,2233,
# 2234,2235,2236,2237,2238,2239,2240,2241,2242,2243,
# 2244,2245,2246,2247,2248,2249,2250,2251,2252,2253,
# 2254,2255,2256,2257,2258,2259,2260,2261,2262,2263
# ]
#VOICE and GPS Prestage
# ids = [1947]
# ids = [1947,1957]
# ids = [1947,1957,1967]
# 10 units
# ids = [1947,1957,1967,1977,1987,1997,2007,2017,2027,2037] # colinde 0-10
# 20 units
# ids = [1947,1957,1967,1977,1987,1997,2007,2017,2027,2037,2047,2057,2067,2077,2087,2097,2107,2117,2127,2137]
# 30 units
# ids = [1947,1957,1967,1977,1987,1997,2007,2017,2027,2037,2047,2057,2067,2077,2087,2097,2107,2117,2127,2137,2147,2157,2167,2177,2187,2197,2207,2217,2227,2237]
# 50 units
# ids = [1947,1957,1967,1977,1987,1997,2007,2017,2027,2037,2047,2057,2067,2077,2087,2097,2107,2117,2127,2137,2147,2157,2167,2177,2187,2197,2207,2217,2227,2237,2247,2257,2267,2277,2287,2297,2307,2317,2327,2337,2347,2357,2367,2377,2387,2397,2407,2417,2427,2437]
# 70 units
# ids = [1947,1957,1967,1977,1987,1997,2007,2017,2027,2037,2047,2057,2067,2077,2087,2097,2107,2117,2127,2137,2147,2157,2167,2177,2187,2197,2207,2217,2227,2237,2247,2257,2267,2277,2287,2297,2307,2317,2327,2337,2347,2357,2367,2377,2387,2397,2407,2417,2427,2437,2447,2457,2467,2477,2487,2497,2507,2517,2527,2537,2547,2557,2567,2577,2587,2597,2597,2607,2617,2627,2637]
#GPS Prestage
# 10 units
# ids = [3842,3843,3844,3845,3846,3847,3848,3849,3850,3851]
# 50 units
# ids = [3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892]
# 100 units
# ids = [3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942]
# 300 units
# ids = [3842,3843,3844,3845,3846,3847,3848,3849,3850,3851,3852,3853,3854,3855,3856,3857,3858,3859,3860,3861,3862,3863,3864,3865,3866,3867,3868,3869,3870,3871,3872,3873,3874,3875,3876,3877,3878,3879,3880,3881,3882,3883,3884,3885,3886,3887,3888,3889,3890,3891,3892,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3893,3894,3895,3896,3897,3898,3899,3900,3901,3902,3903,3904,3905,3906,3907,3908,3909,3910,3911,3912,3913,3914,3915,3916,3917,3918,3919,3920,3921,3922,3923,3924,3925,3926,3927,3928,3929,3930,3931,3932,3933,3934,3935,3936,3937,3938,3939,3940,3941,3942,3943,3944,3945,3946,3947,3948,3949,3950,3951,3952,3953,3954,3955,3956,3957,3958,3959,3960,3961,3962,3963,3964,3965,3966,3967,3968,3969,3970,3971,3972,3973,3974,3975,3976,3977,3978,3979,3980,3981,3982,3983,3984,3985,3986,3987,3988,3989,3990,3991,3992,3993,3994,3995,3996,3997,3998,3999,4000,4001,4002,4003,4004,4005,4006,4007,4008,4009,4010,4011,4012,4013,4014,4015,4016,4017,4018,4019,4020,4021,4022,4023,4024,4025,4026,4027,4028,4029,4030,4031,4032,4033,4034,4035,4036,4037,4038,4039,4040,4041,4042,4043,4044,4045,4046,4047,4048,4049,4050,4051,4052,4053,4054,4055,4056,4057,4058,4059,4060,4061,4062,4063,4064,4065,4066,4067,4068,4069,4070,4071,4072,4073,4074,4075,4076,4077,4078,4079,4080,4081,4082,4083,4084,4085,4086,4087,4088,4089,4090,4091,4092,4093,4094,4095,4096,4097,4098,4099,4100,4101,4102,4103,4104,4105,4106,4107,4108,4109,4110,4111,4112,4113,4114,4115,4116,4117,4118,4119,4120,4121,4122,4123,4124,4125,4126,4127,4128,4129,4130,4131,4132,4133,4134,4135,4136,4137,4138,4139,4140,4141]
# audio-test-100 1947 colinde
# audio-test-110 1957 colinde2
# audio-test-120 1967 colinde3
# audio-test-130 1977 colinde4
# audio-test-140 1987 colinde5
# audio-test-150 1997 colinde6
# audio-test-160 2007 colinde7
# audio-test-170 2017 colinde8
# audio-test-180 2027 colinde9
# audio-test-190 2037 colinde10
# audio-test-200 2047 colinde11
# audio-test-210 2057 colinde12
# audio-test-220 2067 colinde13
# audio-test-230 2077 colinde14
# audio-test-240 2087 colinde15
# audio-test-250 2097 colinde16
# audio-test-260 2107 colinde17
# audio-test-270 2117 colinde18
# audio-test-280 2127 colinde19
# audio-test-290 2137 colinde20
# audio-test-300 2147 colinde21
# audio-test-310 2157 colinde22
# audio-test-320 2167 colinde23
# audio-test-330 2177 colinde24
# audio-test-340 2187 colinde25
# audio-test-350 2197 colinde26
# audio-test-360 2207 colinde27
# audio-test-370 2217 colinde28
# audio-test-380 2227 colinde29
# audio-test-390 2237 colinde30
# audio-test-400 2247 colinde31
# audio-test-410 2257 colinde32
# audio-test-420 2267 colinde33
# audio-test-430 2277 colinde34
# audio-test-440 2287 colinde35
# audio-test-450 2297 colinde36
# audio-test-460 2307 colinde37
# audio-test-470 2317 colinde38
# audio-test-480 2327 colinde39
# audio-test-490 2337 colinde40
# audio-test-500 2347 colinde41
# audio-test-510 2357 colinde42
# audio-test-520 2367 colinde43
# audio-test-530 2377 colinde44
# audio-test-540 2387 colinde45
# audio-test-550 2397 colinde46
# audio-test-360 2407 colinde47
# audio-test-570 2417 colinde48
# audio-test-580 2427 colinde49
# audio-test-590 2437 colinde50
# audio-test-600 2447 colinde51
# audio-test-610 2457 colinde52
# audio-test-620 2467 colinde53
# audio-test-630 2477 colinde54
# audio-test-640 2487 colinde55
# audio-test-650 2497 colinde56
# audio-test-660 2507 colinde57
# audio-test-670 2517 colinde58
# audio-test-680 2527 colinde59
# audio-test-690 2537 colinde60
# audio-test-700 2547 colinde61
# audio-test-710 2557 colinde62
# audio-test-720 2567 colinde63
# audio-test-730 2577 colinde64
# audio-test-740 2587 colinde65
# audio-test-750 2597 colinde66
# audio-test-760 2607 colinde67
# audio-test-770 2617 colinde68
# audio-test-780 2627 colinde69
# audio-test-790 2637 colinde70
[sounds]
#sound = 'sound.mp3'
#sound = 'Donald Trump Sings I Will Survive (64 kbps).mp3'
#sounds_total_number = 20
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']
sound = 'sound.mp3'
sounds_total_number = 20

View File

@ -1,6 +1,4 @@
#!/bin/sh
OPENSSL_PATH="/usr/bin" #default install path
#OPENSSL_PATH="/usr/local/ssl/bin" #workaround for dual openssl install
DAYS=$((10*365))
LEVELS=1
@ -14,10 +12,10 @@ OPENSSL_CNF="/etc/ssl/openssl.cnf"
mkdir -p $CERTS_PATH
#generate root key pair
$OPENSSL_PATH/openssl genrsa -out "$CERTS_PATH/root-key.pem" 4096
openssl genrsa -out "$CERTS_PATH/root-key.pem" 4096
#generate root self-signed cert
$OPENSSL_PATH/openssl req -new -x509 -days $DAYS -key "$CERTS_PATH/root-key.pem" -subj "$DN/CN=Root" -out "$CERTS_PATH/root-cert.pem"
openssl req -new -x509 -days $DAYS -key "$CERTS_PATH/root-key.pem" -subj "$DN/CN=Root" -out "$CERTS_PATH/root-cert.pem"
cat "$CERTS_PATH/root-cert.pem" > $CHAIN
@ -32,17 +30,17 @@ for i in `seq 1 $LEVELS`; do
fi
#generate key pair
$OPENSSL_PATH/openssl genrsa -out "$CERTS_PATH/ca$i-key.pem" 4096
openssl genrsa -out "$CERTS_PATH/ca$i-key.pem" 4096
#generate signing request
$OPENSSL_PATH/openssl req -new -key "$CERTS_PATH/ca$i-key.pem" -subj "$DN/CN=Level$i" -out "$CERTS_PATH/ca$i-csr.pem"
openssl req -new -key "$CERTS_PATH/ca$i-key.pem" -subj "$DN/CN=Level$i" -out "$CERTS_PATH/ca$i-csr.pem"
echo "-------------"
echo ">>>>>>>>>>>>>>>>>"$SIGNER_CERT
echo ">>>>>>>>>>>>>>>>>"$SIGNER_KEY
#sign new cert
$OPENSSL_PATH/openssl x509 -req -days $DAYS -in "$CERTS_PATH/ca$i-csr.pem" -CA $SIGNER_CERT -CAkey $SIGNER_KEY \
openssl x509 -req -days $DAYS -in "$CERTS_PATH/ca$i-csr.pem" -CA $SIGNER_CERT -CAkey $SIGNER_KEY \
-set_serial $i -out "$CERTS_PATH/ca$i-cert.pem" -extfile $OPENSSL_CNF -extensions v3_ca
cat "$CERTS_PATH/ca$i-cert.pem" >> $CHAIN
echo "-------------"

View File

@ -1,6 +1,5 @@
#!/bin/sh
OPENSSL_PATH="/usr/bin" #default install path
#OPENSSL_PATH="/usr/local/ssl/bin" #workaround for dual openssl install
if test "$#" -ne 1; then
echo "Error: Wrong parameters --> You must provide the certificate name."
echo "Please use: ./createCerts.sh 18"
@ -14,11 +13,11 @@ ID=$1
CERTS_PATH=certs
#generate key pair
$OPENSSL_PATH/openssl genrsa -out "$CERTS_PATH/$ID-key.pem" 4096
openssl genrsa -out "$CERTS_PATH/$ID-key.pem" 4096
#generate signing request
$OPENSSL_PATH/openssl req -new -key "$CERTS_PATH/$ID-key.pem" -subj "$DN/CN=$ID" -out "$CERTS_PATH/$ID-csr.pem"
openssl req -new -key "$CERTS_PATH/$ID-key.pem" -subj "$DN/CN=$ID" -out "$CERTS_PATH/$ID-csr.pem"
#sign new cert
$OPENSSL_PATH/openssl x509 -req -days $DAYS -in "$CERTS_PATH/$ID-csr.pem" -CA "$CERTS_PATH/ca1-cert.pem" \
openssl x509 -req -days $DAYS -in "$CERTS_PATH/$ID-csr.pem" -CA "$CERTS_PATH/ca1-cert.pem" \
-CAkey "$CERTS_PATH/ca1-key.pem" -set_serial 500 -out "$CERTS_PATH/$ID-cert.pem"

View File

@ -6,8 +6,8 @@ const Simulator = require('./src/simulator');
// Read configs.
let configs = {
// mumble: config.get('mumble'),
// hub: config.get('hub'),
mumble: config.get('mumble'),
hub: config.get('hub'),
api: config.get('api'),
assets: config.get('assets'),
sounds: config.get('sounds'),
@ -15,9 +15,6 @@ let configs = {
elogs: config.get('elogs'),
}
console.log('configs', configs)
// Start simulation.
console.log('Starting simulation...');
var simulator = new Simulator(configs);

View File

@ -5,10 +5,18 @@ apt-get -qq update
apt-get install -y build-essential
apt-get install -y curl
apt-get install -y python-minimal
curl -sL https://deb.nodesource.com/setup_8.x | bash
apt-get install -y nodejs
# install node 8
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
nvm install v8.17.0
# add node 8 for all users
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"
sudo apt install -y alsa-utils
sudo apt-get install -y libasound2-dev
sudo npm i -g node-gyp
mkdir simulator
# mkdir simulator
# scp -P 2222 ./ vagrant@127.0.0.1:.

View File

@ -1,10 +0,0 @@
#!/bin/sh
cd /usr/local/
wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz
tar -xzvf openssl-1.0.2g.tar.gz
cd openssl-1.0.2g/
./config
make install
/usr/local/ssl/bin/openssl version

View File

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
sounds/poke.mp3 Normal file

Binary file not shown.

BIN
sounds/sound.mp3 Normal file

Binary file not shown.

BIN
sounds/sound.mp3_counting Normal file

Binary file not shown.

BIN
sounds/soundbad.mp3 Normal file

Binary file not shown.

View File

@ -18,32 +18,23 @@ const log = require('./utils').log
class Asset {
constructor(asset, configs, token) {
constructor(id, configs, token) {
this.id = asset.asset_id;
this.mumbleHost = null;
this.mumblePort = null;
this.murmurUser = null;
this.murmurPassword = null;
this.hubAddress = null;
this.group_id = asset.group_id;
this.generate_voice = asset.generate_voice || false;
this.generate_gps = asset.generate_gps || false;
this.id = id;
this.token = token;
this.configs = configs
this._processConfigs();
this.pttEndSuccessfully = false;
this.assetProps = {};
this.murmurPassword = '';
this.startTime = null; // Will be set at the initialization of ptt(_start -> on_tt)
this.endTime = +new Date() + (this.configs.settings.testing_duration * 1000)
utils.writeLog(`Creating asset ${this.id}`)
utils.writeLog(`Creating asset ${id}`)
// Do async work: Init asset.
async.waterfall([
this._getConfiguration.bind(this),
this._getDataFromApi.bind(this),
this._checkGroupToJoin.bind(this),
this._connectToHub.bind(this),
this._connectToMurmur.bind(this),
this._register.bind(this),
@ -53,7 +44,6 @@ class Asset {
utils.writeLog(`Asset ${this.id} was successfully initialized`)
if (err) {
console.log('err', err)
utils.writeLog(`Asset ${this.id} was not successfully initialized`, err);
return;
}
@ -63,72 +53,12 @@ class Asset {
});
}
_processConfigs(callback) {
_processConfigs() {
let apiConfig = this.configs.api;
this.apiEndpoint = apiConfig.use_secure ? 'https' : 'http';
this.apiEndpoint += '://' + apiConfig.host + (apiConfig.port ? (':' + apiConfig.port) : '');
}
_getConfiguration(callback) {
console.log('_getConfiguration', this.id);
Request.get(
this.apiEndpoint + '/asset/' + this.id + '/account',
{
headers: {
Authorization: `Bearer ${this.token}`
}
},
(error, response, body) => {
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
const bodyObj = JSON.parse(body);
const data = bodyObj.data;
// console.log('_getConfiguration', data);
this.mumbleHost = data.configuration.mumble_address;
this.mumblePort = data.configuration.voice_rtp_port;
this.murmurUser = bodyObj.data.configuration.mumble_username;
this.murmurPassword = bodyObj.data.configuration.mumble_password;
this.hubAddress = data.configuration.hub_address;
return callback();
} else {
utils.writeLog(`ERROR | _getConfiguration | response ${JSON.stringify(response)} | body: ${JSON.stringify(body)}`)
utils.writeLog(`ERROR | _getConfiguration | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getConfiguration`);
return callback(error);
}
}
);
}
_checkGroupToJoin(callback) {
console.log('_checkGroupToJoin', this.id);
Request.get(
this.apiEndpoint + '/assets/' + this.id + '/groups',
{
headers: {
Authorization: `Bearer ${this.token}`
}
},
(error, response, body) => {
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
const bodyObj = JSON.parse(body);
const data = bodyObj.data.map(group => group.group_id);
if (data.includes(this.group_id)) {
utils.writeLog(`Asset ${this.id} have group ${this.group_id}`);
return callback();
} else {
utils.writeLog(`ERROR Asset ${this.id} is not in group ${this.group_id}`);
return;
}
} else {
utils.writeLog(`_checkGroupToJoin | response ${JSON.stringify(response)} | body: ${JSON.stringify(body)}`)
utils.writeLog(`ERROR | _checkGroupToJoin | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _checkGroupToJoin`);
return callback(error);
}
}
);
}
_getDataFromApi(callback) {
utils.writeLog(`Get informations about asset ${this.id}`);
Request.get(
@ -141,11 +71,40 @@ class Asset {
(error, response, body) => {
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
let bodyObj = JSON.parse(body);
// Here are the asset fields.
this.assetProps = bodyObj.data;
// console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.assetProps)
return this._getMumblePassword(callback);
} else {
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API`);
return callback(error);
}
}
);
}
_getMumblePassword(callback) {
utils.writeLog(`Get Mumble password for asset ${this.id}`);
Request.get(
this.apiEndpoint + '/asset/' + this.id + '/account',
{
headers: {
Authorization: `Bearer ${this.token}`
}
},
(error, response, body) => {
if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
let bodyObj = JSON.parse(body);
// Here are the asset fields.
this.murmurPassword = bodyObj.data.configuration.mumble_password;
// console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!', this.assetProps)
return this._getGroupsFromApi(callback);
} else {
utils.writeLog(`ERROR | _getDataFromApi | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getDataFromApi`);
utils.writeLog(`ERROR getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API`);
return callback(error);
}
}
@ -168,33 +127,23 @@ class Asset {
this.groups = bodyObj.data;
if (this.group_id) {
this.groups.forEach((g) => {
if (g.id === this.group_id) {
this.groupSipId = g.sip_id;
this.groupName = g.name;
}
});
} else {
this.groups.forEach((g) => {
if (g.is_talk_group && g.monitoring.indexOf(this.id) != -1) {
this.groupSipId = g.sip_id;
this.groupName = g.name;
this.group_id = g.id;
}
})
}
// Find what group this asset is monitoring.
this.groups.forEach((g) => {
if (g.is_talk_group && g.monitoring.indexOf(this.id) != -1) {
this.groupId = g.id;
this.groupSipId = g.sip_id;
this.groupName = g.name;
}
});
if (!this.group_id) {
utils.writeLog(`Group/Default voice group not found for asset: ${this.group_id}`);
if (!this.groupId) {
return callback('No talk group assigned to ' + this.id);
}
utils.writeLog(`Group: ${this.group_id} found for asset: ${this.id}`);
utils.writeLog(`Informations about asset ${this.id} received | groupId: ${this.group_id} | groupName: ${this.groupName}`);
utils.writeLog(`Informations about asset ${this.id} received`)
return callback();
} else {
utils.writeLog(`ERROR | _getGroupsFromApi | Getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API | _getGroupsFromApi`);
utils.writeLog(`Error getting informations about asset ${this.id}`, error);
utils.writeErrorLog(`ERROR_API`);
return callback(error);
}
}
@ -202,8 +151,10 @@ class Asset {
}
_connectToHub(callback) {
let hubAddress = this.configs.hub.address;
let options = {rejectUnauthorized: false, secure: true};
let hub = io(this.hubAddress, options);
let hub = io(hubAddress, options);
this.hub = hub;
// Disconnect event
@ -213,15 +164,16 @@ class Asset {
hub.on('connect_timeout', () => {
utils.writeLog(`Asset ${this.id} connect_timeout from HUB`);
utils.writeErrorLog(`ERROR_HUB | _connectToHub`);
utils.writeErrorLog(`ERROR_HUB`);
});
hub.on('connect_error', () => {
utils.writeLog(`Asset ${this.id} connect_error from HUB`);
utils.writeErrorLog(`ERROR_HUB | _connectToHub`);
utils.writeErrorLog(`ERROR_HUB`);
});
hub.once('connect', () => {
console.log('11111111111111111111')
return callback();
});
hub.on('connect', () => {
@ -258,30 +210,23 @@ class Asset {
}
_connectToMurmur(callback) {
if (!this.group_id) { return callback(); }
this.configs.murmurPassword = this.murmurPassword;
console.log(`Asset ${this.id} connecting to Murmur`);
const murmurConnectionDetails = {
mumbleHost: this.mumbleHost,
mumblePort: this.mumblePort,
murmurUser: this.murmurUser,
murmurPassword: this.murmurPassword
};
this.mumble = new Mumble(this.id, murmurConnectionDetails, (err) => {
this.mumble = new Mumble(this.id, this.configs, (err) => {
if (err) {
utils.writeLog(`ERROR | _connectToMurmur | Asset ${this.id} Murmur connection error`, err);
utils.writeErrorLog(`ERROR_MURMUR | _connectToMurmur`);
utils.writeLog(`Asset ${this.id} Murmur connection error`, err);
utils.writeErrorLog(`ERROR_MURMUR`);
return callback(err);
} else {
// return callback();
setTimeout(()=> {
return callback();
}, 500);
}, 400);
}
});
}
_register(callback) {
console.log(`Asset ${this.id} connecting to Register`);
Request.post(
this.apiEndpoint + '/audio/register/' + this.id,
{
@ -294,19 +239,21 @@ class Asset {
utils.writeLog(`Asset ${this.id} audio registered`);
return callback();
} else {
utils.writeLog(`ERROR | _register | Asset ${this.id} audio registered error`, error);
utils.writeErrorLog(`ERROR_AUDIO | _register`);
return callback(error);
console.log('_register--------------------')
console.log('error---', error)
console.log('response---', response)
console.log('body---', body)
// utils.writeLog(`Asset ${this.id} audio registered error`, error);
// utils.writeErrorLog(`ERROR_API`);
// return callback(error);
}
}
);
}
_moveToChannel(callback) {
console.log(`Asset ${this.id} move to Channel ${this.group_id}`);
// console.log('_moveToChannel', this.apiEndpoint + '/audio/enter-group/' + this.id + '/' + this.group_id)
Request.post(
this.apiEndpoint + '/audio/enter-group/' + this.id + '/' + this.group_id,
this.apiEndpoint + '/audio/enter-group/' + this.id + '/' + this.groupId,
{
headers: {
Authorization: `Bearer ${this.token}`
@ -324,37 +271,55 @@ class Asset {
asset_alias : this.assetProps.name,
request_ptt_groups_status: false,
group_sip_id: this.groupSipId,
group_id: this.group_id,
group_id: this.groupId,
group_name: this.groupName,
scan_group_ids: null
}
));
utils.writeLog(`Asset ${this.id} monitoring group ${this.group_id}`)
if (callback) return callback();
utils.writeLog(`Asset ${this.id} mmonitoring group ${this.groupId}`)
return callback();
} else {
if (callback) return callback('Cannot send group-monitoring: Hub not connected');
return callback('Cannot send group-monitoring: Hub not connected');
}
} else {
utils.writeLog(`ERROR | _moveToChannel | Asset ${this.id} audio enter group error`, error);
utils.writeErrorLog(`ERROR_AUDIO | _moveToChannel`);
return callback(error);
console.log('_moveToChannel--------------------')
console.log('error---', error)
console.log('response---', response)
console.log('body---', body)
// utils.writeLog(`Asset ${this.id} audio enter group error`, error);
// utils.writeErrorLog(`ERROR_API`);
// return callback(error);
}
}
);
}
_start() {
this.generate_voice && this._makePtt(); // Generate voce
this.generate_gps && this._sendGPS(); // Generate GPS
this._measuringTestTime(); // Process exit base on this.endTime and current date
}
_measuringTestTime() {
setInterval(() => {
if(Date.now() > this.endTime + 18000) {
process.exit(0)
this.startTime = +new Date();
if(this.endTime > this.startTime) {
if(this.configs.settings.send_voice) {
this._makePtt(() => {
if(this.pttEndSuccessfully) {
this._verifyRecorder();
}
});
}
}, 1000);
if(this.configs.settings.send_gps) {
this._sendGPS();
}
} else {
const assetIds = this.configs.assets.ids;
if(Math.max(...assetIds) == this.id) {
setTimeout(() => {
utils.writeLog('STOP')
.then(() => {
process.exit(0);
});
}, 10000);
}
}
}
_verifyRecorder(callback) {
@ -397,8 +362,8 @@ class Asset {
console.log(chalk.yellow(`[RECORDER] for asset ${this.id} not found`));
}
} else {
utils.writeLog(`ERROR | _getRecord | Error getting record for asset ${this.id} | ${error}`);
utils.writeErrorLog(`ERROR_RECORDER | _getRecord`);
utils.writeLog(`Error getting record for asset ${this.id} | ${error}`);
utils.writeErrorLog(`ERROR_RECORDER`);
}
let assetIds = configs.assets.ids;
@ -409,11 +374,8 @@ class Asset {
}
_makePtt(callback) {
// Sending group monitoring before we make PTT()
// Is used for the HUB load test(_moveToChannel is sent anyway after connecting to murmur-register)
if (this.configs.settings.send_group_monitoring_before_each_call == 'true') {
this._moveToChannel();
}
// Send ptt-press, transmit all the sound then send ptt-release.
// Check hub.
let hub = this.hub;
@ -423,6 +385,7 @@ class Asset {
// Send ptt-press and wait for it to be accepted.
this._sendPttPress((isAccepted) => {
if (!isAccepted) {
return callback();
}
@ -467,11 +430,7 @@ class Asset {
this.pttEndSuccessfully = true;
setTimeout(() => {
this._sendPttRelease();
if(this.endTime > +new Date()) {
this._makePtt(callback);
} else {
utils.writeLog(`Asset ${this.id} Voice sleeping...`);
}
callback();
}, 1500); // Hangtime
});
@ -534,23 +493,14 @@ class Asset {
})
}
_sendGPS() {
_sendGPS(callback) {
let hub = this.hub;
if (hub && hub.connected) {
let lat = this.configs.settings.gps_lat_start_point;
let lng = this.configs.settings.gps_lng_start_point;
const max = this.configs.settings.gps_max_interval;
const min = this.configs.settings.gps_min_interval;
let interval = null;
if (!this.configs.settings.gps_report_interval) {
interval = Math.floor(Math.random() * (max - min + 1) + min);
} else {
interval = this.configs.settings.gps_report_interval;
}
const now = +new Date();
if(this.endTime > now) {
setInterval(() => {
var new_lat = this._randomCoordinates(lat);
var new_lng = this._randomCoordinates(lng);
@ -569,10 +519,8 @@ class Asset {
));
lat = new_lat;
lng = new_lng;
setTimeout(() => { this._sendGPS(); }, interval);
} else {
utils.writeLog(`Asset ${this.id} GPS sleeping...`);
}
}, this.configs.settings.gps_report_interval);
}
}
@ -593,7 +541,7 @@ class Asset {
if (data.asset_id != this.id) {
return;
}
utils.writeLog(`Asset ${this.id} sending PTT-PRESS to group ${this.group_id}`)
utils.writeLog(`Asset ${this.id} sending PTT-PRESS to group ${this.groupId}`)
hub.removeListener('ptt-deny', pttDenyHandler);
callback(true);
};
@ -612,7 +560,7 @@ class Asset {
hub.emit('ptt-press', JSON.stringify(
{
destination_group_id: this.group_id,
destination_group_id: this.groupId,
destination_group_sip_id: this.groupSipId,
destination_asset_id: 0,
destination_asset_sip_id: 0,
@ -631,10 +579,10 @@ class Asset {
let hub = this.hub;
if (hub && hub.connected) {
utils.writeLog(`Asset ${this.id} sending PTT-RELEASE to group ${this.group_id}`);
utils.writeLog(`Asset ${this.id} sending PTT-RELEASE to group ${this.groupId}`);
hub.emit('ptt-release', JSON.stringify(
{
destination_group_id: this.group_id,
destination_group_id: this.groupId,
destination_group_sip_id: this.groupSipId,
destination_asset_id: 0,
destination_asset_sip_id: 0,

View File

@ -11,19 +11,13 @@ const OpusEncoder = require('node-opus').OpusEncoder;
class Mumble {
constructor(id, murmurConnectionDetails, connectedCallback) {
constructor(id, configs, connectedCallback) {
console.log('------', configs)
this.id = id;
this.mumbleHost = murmurConnectionDetails.mumbleHost;
this.mumblePort = murmurConnectionDetails.mumblePort;
this.murmurUser = murmurConnectionDetails.murmurUser;
this.murmurPassword = murmurConnectionDetails.murmurPassword;
// console.log('mumbleHost', this.mumbleHost)
// console.log('mumblePort', this.mumblePort)
// console.log('murmurUser', this.murmurUser)
// console.log('murmurPassword', this.murmurPassword)
this.configs = configs;
let mumble = configs.mumble;
this._createCertificatesForUser(id, () => {
this._makeMumbleConnection(id, this.mumblePort, this.mumbleHost, id, this.murmurPassword, connectedCallback);
this._makeMumbleConnection(id, mumble.port, mumble.host, id, this.configs.murmurPassword, connectedCallback);
})
}
@ -110,7 +104,7 @@ class Mumble {
.on('reconnect', function (n, delay) {
// n = current number of reconnect
// delay = delay used before reconnect
// console.log('------ Server reconnect...');
console.log('------ Server reconnect...');
// utils.writeErrorLog(`ERROR_MUMBLE_RECONNECT`);
// utils.exitWriteErrorLog(`ERROR_MUMBLE_RECONNECT`);
})

View File

@ -12,12 +12,12 @@ class Simulator {
this.configs = configs;
this.token;
this.assets = configs.assets;
this.assetIds = this.assets.map(asset => asset.asset_id);
// Read assets ids from configs
this.assetIds = configs.assets.ids;
this.apiEndpoint = this.configs.api.use_secure ? 'https' : 'http';
this.apiEndpoint += '://' + this.configs.api.host + (this.configs.api.port ? (':' + this.configs.api.port) : '');
async.waterfall([
this._manageLogs.bind(this),
this._unregisterAsstes.bind(this),
@ -36,11 +36,18 @@ class Simulator {
_start() {
const settings = this.configs.settings;
this.assets.forEach((asset, i) => {
console.log('asset_id', asset.asset_id, i * settings.delay_between_clients + 'ms');
this.assetIds.forEach((id, i) => {
let delay_between_clients = 500;
if(settings.hasOwnProperty('delay_between_clients')) {
delay_between_clients = parseInt(settings.delay_between_clients, 10);
}
console.log('id', id, i * delay_between_clients+'ms')
delay_between_clients = this._getRandomInt(delay_between_clients);
setTimeout(() => {
new Asset(asset, this.configs, this.token);
}, i * settings.delay_between_clients);
new Asset(id, this.configs, this.token);
// console.log('id, this.configs, this.token', id, this.configs, this.token)
}, i * delay_between_clients);
})
}
@ -67,7 +74,6 @@ class Simulator {
}
_unregisterAsstes(callback) {
let url = this.apiEndpoint + '/audio/un-register/[' + this.assetIds + ']/';
Request.post(
url,
@ -79,7 +85,7 @@ class Simulator {
return callback(error);
}
else {
utils.writeLog(`Unregister assets: ${this.assetIds}`);
utils.writeLog(`Unregister assets: ${this.assetIds}`)
return callback();
}
}