Skip to content

Commit

Permalink
increase max rerouting attempts in routing plan (#1525)
Browse files Browse the repository at this point in the history
* increase max rerouting attempts in routing plan
* allow plain http in ThinQ LNP driver
  • Loading branch information
dmitry-sinina authored Aug 7, 2024
1 parent e63282a commit e67ab7c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 17 deletions.
4 changes: 3 additions & 1 deletion app/admin/equipment/lnp_databases.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions app/models/lnp/database_thinq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/routing/routing_plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
14 changes: 14 additions & 0 deletions db/migrate/20240806205100_lnp_thinq_plain_http.rb
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
);


Expand Down Expand Up @@ -41197,6 +41198,7 @@ INSERT INTO "public"."schema_migrations" (version) VALUES
('20240721201110'),
('20240725132743'),
('20240725135654'),
('20240805121644');
('20240805121644'),
('20240806205100');


13 changes: 7 additions & 6 deletions spec/models/lnp/database_thinq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e67ab7c

Please sign in to comment.