MT#11501 dialogic api cleanup

refactor to a more generic approach
dependencies
create_all
generate documentation
Change-Id: I718278e4560c3f1e2c14aa9b5585274fa32101dd
changes/99/1199/3
Gerhard Jungwirth 10 years ago
parent b926d468c9
commit cd3111d665

@ -39,6 +39,7 @@ my $builder = Local::Module::Build->new(
'Catalyst::View::TT' => 0,
'Config::General' => 0,
'Data::HAL' => 0,
'Data::Serializer::Raw' => 0,
'Convert::Ascii85' => 0,
'Data::Dumper' => 0,
'Data::Validate::IP' => 0,
@ -81,6 +82,7 @@ my $builder = Local::Module::Build->new(
'Net::Telnet' => 0,
'NGCP::Schema' => '2.003',
'Plack::Middleware::Deflater' => 0,
'Role::REST::Client' => 0,
'RPC::XML::ParserFactory' => 0,
'Scalar::Util' => 0,
'Sereal::Decoder' => 0,

4
debian/control vendored

@ -16,6 +16,7 @@ Build-Depends: debhelper (>= 8),
libcrypt-rijndael-perl,
libdata-hal-perl,
libdata-printer-perl,
libdata-serializer-perl,
libdata-validate-ip-perl,
libdatetime-format-http-perl,
libdatetime-format-iso8601-perl,
@ -48,6 +49,7 @@ Build-Depends: debhelper (>= 8),
libpath-tiny-perl,
libperl5i-perl,
libplack-middleware-deflater-perl,
librole-rest-client-perl,
librsvg2-bin,
libsereal-decoder-perl,
libsereal-encoder-perl,
@ -83,6 +85,7 @@ Depends: gettext,
libcrypt-rijndael-perl,
libdata-hal-perl,
libdata-printer-perl,
libdata-serializer-perl,
libdata-record-perl,
libdata-validate-ip-perl,
libdatetime-format-http-perl,
@ -125,6 +128,7 @@ Depends: gettext,
libpath-tiny-perl,
libperl5i-perl,
libplack-middleware-deflater-perl,
librole-rest-client-perl,
librpc-xml-perl,
librsvg2-bin,
libsereal-decoder-perl,

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -28,280 +28,62 @@ print "LOGGED IN, LOCK OBTAINED ############################\n";
# $resp = $test->reboot_and_wait;
# p $resp;
# exit 0;
# $test->pids->{route_table} = 10033;
# $test->download_route_table;
# $test->pids->{channel_group_collection} = 10030;
# $test->download_channel_groups;
# exit 0;
# $resp = $test->create_route_element({
# StringType => 'Channel Group',
# InChannelGroup => 'ChannelGroup0',
# RouteActionType => 'Channel Group',
# RouteActionList => 'ChannelGroup0',
# });
# sleep 2;
# exit;
# print "login again\n";
# p $test->login( 'dialogic', 'Dial0gic' );
# $resp = $test->get( '/oamp/configuration/objects', { appid => $test->appid } );
# $resp = $test->obtain_lock();
# p $resp->code;
# #p $resp->data;
# exit 0;
$resp = $test->create_bn2020;
p $resp->code;
#p $resp->data;
print "CREATE NETWORK ###################################\n";
$resp = $test->create_network;
p $resp->code;
#p $resp->data;
print "CREATE INTERFACE COLLECTION ###################################\n";
$resp = $test->create_interface_collection;
p $resp->code;
#p $resp->data;
print "CREATE INTERFACE ###################################\n";
$resp = $test->create_interface; # Control by default
p $resp->code;
#p $resp->data;
$resp = $test->create_ip_address({
NIIPAddress => '10.15.20.92',
NIIPPhy => 'Services',
});
p $resp->code;
#p $resp->data;
$resp = $test->create_interface; # DataA by default
p $resp->code;
#p $resp->data;
$resp = $test->create_ip_address({
NIIPAddress => '10.15.21.10',
NIIPPhy => 'Media 0'});
p $resp->code;
#p $resp->data;
print "CREATE FACILITY ###################################\n";
$resp = $test->create_facility;
p $resp->code;
#p $resp->data;
print "CREATE PACKET FACILITY COLLECTION ###################################\n";
$resp = $test->create_packet_facility_collection;
p $resp->code;
#p $resp->data;
print "CREATE PACKET FACILITY ###################################\n";
$resp = $test->create_packet_facility({
ChannelCount => 50, # our licence has 128 or so
});
p $resp->code;
#p $resp->data;
lsign:
print "CREATE SIGNALING ###################################\n";
$resp = $test->create_signaling;
p $resp->code;
#p $resp->data;
print "CREATE SIP ###################################\n";
$resp = $test->create_sip;
p $resp->code;
#p $resp->data;
print "CREATE SIP IP ###################################\n";
$resp = $test->create_sip_ip({
IPAddress => '10.15.20.92',
});
p $resp->code;
#p $resp->data;
print "CREATE PROFILE COLLECTION ###################################\n";
$resp = $test->create_profile_collection;
p $resp->code;
#p $resp->data;
print "CREATE IP PROFILE COLLECTION ###################################\n";
$resp = $test->create_ip_profile_collection;
p $resp->code;
#p $resp->data;
print "CREATE IP PROFILE ###################################\n";
$resp = $test->create_ip_profile({
DigitRelay => 'DTMF Packetized',
});
p $resp->code;
#p $resp->data;
print "CREATE VOCODER PROFILE ###################################\n";
$resp = $test->create_vocoder_profile({
PayloadType => 'G711 ulaw',
});
p $resp->code;
#p $resp->data;
$resp = $test->create_vocoder_profile({
PayloadType => 'G711 alaw',#G711 (u/a)law, G729, G722, AMR, ...
});
p $resp->code;
#p $resp->data;
$resp = $test->create_vocoder_profile({
PayloadType => 'G729',
});
p $resp->code;
#p $resp->data;
$resp = $test->create_vocoder_profile({
PayloadType => 'AMR',
});
p $resp->code;
#p $resp->data;
print "CREATE SIP PROFILE COLLECTION ###################################\n";
$resp = $test->create_sip_profile_collection;
p $resp->code;
#p $resp->data;
print "CREATE SIP PROFILE ###################################\n";
$resp = $test->create_sip_profile({
});
p $resp->code;
#p $resp->data;
# $resp = $test->create_sip_profile({
# });
# p $resp->code;
# #p $resp->data;
print "DOWNLOAD PROFILE COLLECTION ###################################\n";
$resp = $test->download_profiles;
p $resp->code;
#p $resp->data;
print "CREATE EXTERNAL NETWORK ELEMENTS ###################################\n";
$resp = $test->create_external_network_elements;
p $resp->code;
#p $resp->data;
print "CREATE EXTERNAL GATEWAY COLLECTION ###################################\n";
$resp = $test->create_external_gateway_collection;
p $resp->code;
#p $resp->data;
print "CREATE EXTERNAL GATEWAY ###################################\n";
$resp = $test->create_external_gateway({
Name => 'Phone1',
IPAddress => '10.15.20.199',
IPAddress4 => '10.15.20.199',
});
p $resp->code;
#p $resp->data;
print "CREATE ROUTING CONFIGURATION ###################################\n";
$resp = $test->create_routing_configuration({
});
p $resp->code;
#p $resp->data;
print "CREATE CHANNEL GROUP COLLECTION ###################################\n";
$resp = $test->create_channel_group_collection({
});
p $resp->code;
#p $resp->data;
print "CREATE ROUTE TABLE COLLECTION ###################################\n";
$resp = $test->create_route_table_collection;
p $resp->code;
#p $resp->data;
print "CREATE ROUTE TABLE ###################################\n";
$resp = $test->create_route_table({
#Name => 'ngcp_route_table',
});
p $resp->code;
#p $resp->data;
print "CREATE CHANNEL GROUP ###################################\n";
$resp = $test->create_channel_group({
SignalingType => 'SIP',
#RouteTable => ???,
InRouteTable => 'Table - ID: 5',
InIPProfile => 'IP_Profile_1',
InIPProfileId => '1',
OutIPProfile => 'IP_Profile_1',
#incoming ip profile, set?
#outgoing ip profile, set?
SupportA2F => 'True',
});
p $resp->code;
#p $resp->data;
print "CREATE NETWORK ELEMENT (CG) ###################################\n";
$resp = $test->create_cg_network_element;
p $resp->code;
#p $resp->data;
print "CREATE NODE ASSOCIATION ###################################\n";
$resp = $test->create_node_association;
p $resp->code;
#p $resp->data;
print "CREATE ROUTE ELEMENT ###################################\n";
$resp = $test->create_route_element({
StringType => 'Channel Group',
InChannelGroup => 'ChannelGroup0',
RouteActionType => 'Channel Group',
RouteActionList => 'ChannelGroup0',
});
p $resp->code;
#p $resp->data;
$resp = $test->download_route_table;
p $resp->code;
$resp = $test->download_channel_groups;
p $resp->code;
# print_documentation_md($test);
my $result = $test->create_all_sipsip({
ip1 => '10.15.20.92',
ip2 => '10.15.21.10',
ip_client => '10.15.20.199',
in_codecs => ['G711 ulaw', 'G711 alaw', 'G729', 'AMR'],
out_codecs => ['G711 ulaw', 'G711 alaw', 'G729', 'AMR'], # not yet used
},
2,
);
exit;
sub print_documentation_md {
my ($api) = @_;
my $classinfo = $api->build_documentation;
for my $class (keys %{ $classinfo }) {
my $parent = $classinfo->{$class}{parent};
my $options = $classinfo->{$class}{options};
print "\n#$class\n\n";
print "This is a child of `$parent`\n\n";
print "## Options\n\n";
print "Name|Description|Default|Alternatives\n";
print "----|-----------|-------|------------\n";
for my $o (@{ $options }) {
my ( $name, $displayname, $default, $choices )
= @{$o}{ 'name', 'displayname', 'default', 'choices' };
my $choices_str = $choices && @$choices ? join(", ", map { "`$_`" } @{$choices}) : '';
if ($default) {
$default = "`$default`";
}
print "`$name` | $displayname | $default | $choices_str \n";
}
}
return;
}
sub try_parse_file {
return unless ($#ARGV >= 1);
print "parsing $ARGV[0]\n";
use Data::Serializer::Raw;
my $s = Data::Serializer::Raw->new(serializer => 'XML::Simple');
print Dumper $s->retrieve($ARGV[0]);
print "\n";
return 1;
return unless ($#ARGV >= 1);
print "parsing $ARGV[0]\n";
use Data::Serializer::Raw;
my $s = Data::Serializer::Raw->new(serializer => 'XML::Simple');
print Dumper $s->retrieve($ARGV[0]);
print "\n";
return 1;
}
1;

Loading…
Cancel
Save