MT#61288 support config_pro.yml configs

Change-Id: Ieef16dc79f2f7d9c0b6599689abb4470c06449c3
mr13.1
Victor Seva 5 months ago
parent 5e4f91187e
commit 193d782dd9

@ -35,6 +35,7 @@ sub usage
$output .= "\t-g: scenarios group\n"; $output .= "\t-g: scenarios group\n";
$output .= "\t-c: number of kamailio.proxy.children\n"; $output .= "\t-c: number of kamailio.proxy.children\n";
$output .= "\t-t: enable cfgt\n"; $output .= "\t-t: enable cfgt\n";
$output .= "\t-p: PRO configs\n";
$output .= "\tkct_config.yml: config file for k-c-t environment\n"; $output .= "\tkct_config.yml: config file for k-c-t environment\n";
$output .= "\tMODE: on|off\tdefault: off\n"; $output .= "\tMODE: on|off\tdefault: off\n";
return $output return $output
@ -43,6 +44,7 @@ sub usage
my $help = 0; my $help = 0;
my $children = 0; my $children = 0;
my $group; my $group;
my $PRO = 0;
my $cfgt = 0; my $cfgt = 0;
if (exists $ENV{'GROUP'}) if (exists $ENV{'GROUP'})
@ -57,6 +59,7 @@ GetOptions (
"h|help" => \$help, "h|help" => \$help,
"g|group=s" => \$group, "g|group=s" => \$group,
"c|children=i" => \$children, "c|children=i" => \$children,
"p|pro" => \$PRO,
"t" => \$cfgt, "t" => \$cfgt,
) or die("Error in command line arguments\n".usage()); ) or die("Error in command line arguments\n".usage());
@ -105,6 +108,16 @@ sub change_config
$yaml->{rtpengine}{log_level} = '7'; $yaml->{rtpengine}{log_level} = '7';
$yaml->{modules}[0]->{enable} = 'yes'; # dummy module should be the first one $yaml->{modules}[0]->{enable} = 'yes'; # dummy module should be the first one
(my $pro_yml_file = $file_yaml) =~ s/\.yml/_pro.yml/;
if ( -e $pro_yml_file && $PRO)
{
print "load $pro_yml_file config file\n";
my $pro_yml = LoadFile($pro_yml_file);
my $hm = Hash::Merge->new('RIGHT_PRECEDENT');
my $config = $hm->merge( {}, $yaml);
$yaml = $hm->merge( $config, $pro_yml);
}
my $group_yml_file = $base_dir."/".$group."/config.yml"; my $group_yml_file = $base_dir."/".$group."/config.yml";
if ( -e $group_yml_file ) if ( -e $group_yml_file )
{ {
@ -116,6 +129,15 @@ sub change_config
} else { } else {
print "$group_yml_file not found\n"; print "$group_yml_file not found\n";
} }
$group_yml_file = $base_dir."/".$group."/config_pro.yml";
if ( -e $group_yml_file && $PRO)
{
print "load $group_yml_file config file\n";
my $group_yml = LoadFile($group_yml_file);
my $hm = Hash::Merge->new('RIGHT_PRECEDENT');
my $config = $hm->merge( {}, $yaml);
$yaml = $hm->merge( $config, $group_yml);
}
DumpFile($file_yaml, $yaml); DumpFile($file_yaml, $yaml);
} }

@ -37,5 +37,3 @@ kamailio:
enable: no enable: no
allow_refer_method: no allow_refer_method: no
generate_responder_cdr_data: no generate_responder_cdr_data: no
pbx:
enable: no

@ -0,0 +1,3 @@
---
pbx:
enable: no

@ -16,5 +16,3 @@ kamailio:
skip_cf_loop: 'yes' skip_cf_loop: 'yes'
allow_refer_method: no allow_refer_method: no
generate_responder_cdr_data: no generate_responder_cdr_data: no
pbx:
enable: no

@ -0,0 +1,3 @@
---
pbx:
enable: no

@ -152,6 +152,9 @@ config() {
"${BIN_DIR}/detect_network.py" --verbose "${BASE_DIR}/config.yml" /etc/ngcp-config/network.yml "${BIN_DIR}/detect_network.py" --verbose "${BASE_DIR}/config.yml" /etc/ngcp-config/network.yml
fi fi
opts="-c 5 -g ${GROUP}" opts="-c 5 -g ${GROUP}"
if [ "${PROFILE}" == "PRO" ]; then
opts+=" -p"
fi
if ${CFGT} ; then if ${CFGT} ; then
opts+=" -t" opts+=" -t"
fi fi

Loading…
Cancel
Save