From e67ab7ca640e4270a851227e2ddfe9d7795485a5 Mon Sep 17 00:00:00 2001 From: Dmitry Sinina Date: Wed, 7 Aug 2024 10:19:47 +0300 Subject: [PATCH] increase max rerouting attempts in routing plan (#1525) * increase max rerouting attempts in routing plan * allow plain http in ThinQ LNP driver --- app/admin/equipment/lnp_databases.rb | 4 +++- app/models/lnp/database_thinq.rb | 13 +++++++------ app/models/routing/routing_plan.rb | 2 +- config/locales/en.yml | 2 +- db/migrate/20240806205100_lnp_thinq_plain_http.rb | 14 ++++++++++++++ db/structure.sql | 6 ++++-- spec/models/lnp/database_thinq_spec.rb | 13 +++++++------ 7 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20240806205100_lnp_thinq_plain_http.rb diff --git a/app/admin/equipment/lnp_databases.rb b/app/admin/equipment/lnp_databases.rb index d2e47d179..bfbaa62e6 100644 --- a/app/admin/equipment/lnp_databases.rb +++ b/app/admin/equipment/lnp_databases.rb @@ -99,6 +99,7 @@ case resource.database_type when Lnp::Database::CONST::TYPE_THINQ row :host + row :plain_http row :port row :timeout row :username @@ -137,7 +138,7 @@ case database_type when Lnp::Database::CONST::TYPE_THINQ - database_attrs += %i[host port username token timeout] + database_attrs += %i[host plain_http port username token timeout] when Lnp::Database::CONST::TYPE_SIP_REDIRECT database_attrs += %i[host port timeout format_id] when Lnp::Database::CONST::TYPE_CSV @@ -167,6 +168,7 @@ case f.object.database_type when Lnp::Database::CONST::TYPE_THINQ o.input :host + o.input :plain_http o.input :port o.input :username o.input :token diff --git a/app/models/lnp/database_thinq.rb b/app/models/lnp/database_thinq.rb index 748be71eb..fac3d7bf3 100644 --- a/app/models/lnp/database_thinq.rb +++ b/app/models/lnp/database_thinq.rb @@ -4,12 +4,13 @@ # # Table name: class4.lnp_databases_thinq # -# id :integer(2) not null, primary key -# host :string not null -# port :integer(4) -# timeout :integer(2) default(300), not null -# token :string -# username :string +# id :integer(2) not null, primary key +# host :string not null +# plain_http :boolean default(FALSE), not null +# port :integer(4) +# timeout :integer(2) default(300), not null +# token :string +# username :string # class Lnp::DatabaseThinq < ApplicationRecord diff --git a/app/models/routing/routing_plan.rb b/app/models/routing/routing_plan.rb index f853b57d3..8bfde39ac 100644 --- a/app/models/routing/routing_plan.rb +++ b/app/models/routing/routing_plan.rb @@ -66,7 +66,7 @@ class Routing::RoutingPlan < ApplicationRecord validates :name, :max_rerouting_attempts, presence: true validates :name, uniqueness: { allow_blank: false } - validates :max_rerouting_attempts, numericality: { greater_than: 0, less_than_or_equal_to: 10, allow_nil: false, only_integer: true } + validates :max_rerouting_attempts, numericality: { greater_than: 0, less_than_or_equal_to: 30, allow_nil: false, only_integer: true } validates :external_id, uniqueness: { allow_blank: true } validates :sorting_id, inclusion: { in: SORTINGS.keys }, allow_nil: false diff --git a/config/locales/en.yml b/config/locales/en.yml index 0f180849a..0a40bbdeb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -108,7 +108,7 @@ en: destination: reverse_billing: "If enabled, customer account balance is raised" routing_routing_plan: - max_rerouting_attempts: "Should be in range 1..10" + max_rerouting_attempts: "Should be in range 1..30" dialpeers: reverse_billing: "If enabled, vendor account balance is lowered" equipment_registration: diff --git a/db/migrate/20240806205100_lnp_thinq_plain_http.rb b/db/migrate/20240806205100_lnp_thinq_plain_http.rb new file mode 100644 index 000000000..f4076ca0b --- /dev/null +++ b/db/migrate/20240806205100_lnp_thinq_plain_http.rb @@ -0,0 +1,14 @@ +class LnpThinqPlainHttp < ActiveRecord::Migration[7.0] + def up + execute %q{ + ALTER TABLE class4.lnp_databases_thinq add plain_http boolean not null default false; + } + end + + def down + execute %q{ + ALTER TABLE class4.lnp_databases_thinq drop column plain_http; + } + end + +end diff --git a/db/structure.sql b/db/structure.sql index c1fc1922e..2ba6edfd4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -32676,7 +32676,8 @@ CREATE TABLE class4.lnp_databases_thinq ( port integer, timeout smallint DEFAULT 300 NOT NULL, username character varying, - token character varying + token character varying, + plain_http boolean DEFAULT false NOT NULL ); @@ -41197,6 +41198,7 @@ INSERT INTO "public"."schema_migrations" (version) VALUES ('20240721201110'), ('20240725132743'), ('20240725135654'), -('20240805121644'); +('20240805121644'), +('20240806205100'); diff --git a/spec/models/lnp/database_thinq_spec.rb b/spec/models/lnp/database_thinq_spec.rb index b715ec00a..a27166f03 100644 --- a/spec/models/lnp/database_thinq_spec.rb +++ b/spec/models/lnp/database_thinq_spec.rb @@ -4,12 +4,13 @@ # # Table name: class4.lnp_databases_thinq # -# id :integer(2) not null, primary key -# host :string not null -# port :integer(4) -# timeout :integer(2) default(300), not null -# token :string -# username :string +# id :integer(2) not null, primary key +# host :string not null +# plain_http :boolean default(FALSE), not null +# port :integer(4) +# timeout :integer(2) default(300), not null +# token :string +# username :string # RSpec.describe Lnp::DatabaseThinq, type: :model do