From 1497232e2c4d6e536d49a84b73b99b7d4370c951 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Thu, 9 Feb 2017 21:02:07 +0200 Subject: [PATCH] TT#9212 Fix redirect_params access Change-Id: Ia7de23a8238e2bbcc0d65a6a33c2a05f74cde0b0 --- lib/NGCP/Panel/Utils/DeviceBootstrap.pm | 4 ++++ lib/NGCP/Panel/Utils/DeviceBootstrap/Grandstream.pm | 6 +++--- lib/NGCP/Panel/Utils/DeviceBootstrap/VendorRPC.pm | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/NGCP/Panel/Utils/DeviceBootstrap.pm b/lib/NGCP/Panel/Utils/DeviceBootstrap.pm index 8cb745dc34..94eb75ac49 100644 --- a/lib/NGCP/Panel/Utils/DeviceBootstrap.pm +++ b/lib/NGCP/Panel/Utils/DeviceBootstrap.pm @@ -82,6 +82,7 @@ sub get_devmod_params{ }; return $params; } + sub get_redirect_processor{ my ($params) = @_; my $c = $params->{c}; @@ -121,6 +122,7 @@ sub devmod_sync_parameters_prefetch{ } return \@parameters; } + sub devmod_sync_credentials_prefetch{ my($c,$devmod,$params) = @_; my $schema = $c->model('DB'); @@ -133,6 +135,7 @@ sub devmod_sync_credentials_prefetch{ } return $credentials; } + sub devmod_sync_credentials_store{ my($c,$devmod,$credentials) = @_; my $schema = $c->model('DB'); @@ -156,6 +159,7 @@ sub devmod_sync_clear { } } } + sub devmod_sync_parameters_store { my($c,$devmod,$sync_parameters) = @_; my $schema = $c->model('DB'); diff --git a/lib/NGCP/Panel/Utils/DeviceBootstrap/Grandstream.pm b/lib/NGCP/Panel/Utils/DeviceBootstrap/Grandstream.pm index e8632e6fff..6255187528 100644 --- a/lib/NGCP/Panel/Utils/DeviceBootstrap/Grandstream.pm +++ b/lib/NGCP/Panel/Utils/DeviceBootstrap/Grandstream.pm @@ -32,7 +32,7 @@ sub register_content { my $self = shift; #TODO: remove actual cid here $self->{register_content} = - '{"cid":"'.$self->params->{cid} + '{"cid":"'.$self->params->{redirect_params}->{cid} .'","method":"redirectDefault","params":{"macs":["' .$self->content_params->{mac}.'"]}}'; @@ -44,7 +44,7 @@ sub register_content { sub unregister_content { my $self = shift; $self->{unregister_content} = - '{"cid":"'.$self->params->{cid} + '{"cid":"'.$self->params->{redirect_params}->{cid} .'","method":"unDeviceProvision","params":{"macs":["' .$self->content_params->{mac}.'"]}}'; @@ -101,7 +101,7 @@ sub get_server_time { sub get_request_sign{ my $self = shift; my ($request,$time) = @_; - my $key = $self->params->{key}; + my $key = $self->params->{redirect_params}->{key}; $time //= $self->get_server_time(); my $str2sign = $request.$time; my ($sign,$sign_error); diff --git a/lib/NGCP/Panel/Utils/DeviceBootstrap/VendorRPC.pm b/lib/NGCP/Panel/Utils/DeviceBootstrap/VendorRPC.pm index 168ea129d7..dbbb2088a4 100644 --- a/lib/NGCP/Panel/Utils/DeviceBootstrap/VendorRPC.pm +++ b/lib/NGCP/Panel/Utils/DeviceBootstrap/VendorRPC.pm @@ -107,6 +107,7 @@ sub extract_response_description{ return; } } + sub init_content_params{ my($self) = @_; $self->{content_params} ||= {}; @@ -117,6 +118,7 @@ sub init_content_params{ $self->content_params->{mac_old} = normalize_mac($self->params->{mac_old}); } } + sub normalize_mac { my ($mac) = @_; return unless($mac); @@ -167,6 +169,7 @@ sub bootstrap_uri_mac{ } return $uri; } + #separated as this logic also used in other places, so can be moved to other utils module sub bootstrap_uri_conf{ my ($self) = @_;