New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dp): Enodebd triggered update #12804
Conversation
👷 Deploy request for competent-euler-513227 pending review.Visit the deploys page to approve it
|
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
description: AGL - relative to the ground level. AMSL - relative to the mean | ||
sea level | ||
enum: | ||
- agl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[yamllint] reported by reviewdog 🐶
[error] wrong indentation: expected 10 but found 8 (indentation)
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the Python Format Check after the last commit. |
550f354
to
c4d8557
Compare
@@ -16,8 +16,8 @@ spec: | |||
- image: test_runner_image | |||
name: test-runner-orc8 | |||
imagePullPolicy: IfNotPresent | |||
command: ["python"] | |||
args: ["-m", "pytest", "-vvv", "-s", "-m", "orc8r", "--junit-xml=/backend/test_runner/test-results/test_report.xml", "tests"] | |||
command: ["sleep"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sklgromek I think we should add some target to makefile to do that, since this is not the first time such debugging version was committed by accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkmar I agree. I will prepare something for that
@@ -0,0 +1,517 @@ | |||
package builders_test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is separate package already, I would go with just builders
as package name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
"magma/dp/cloud/go/services/dp/storage/db" | ||
) | ||
|
||
func dbFloat64OrNil(field *sql.NullFloat64, val *wrappers.DoubleValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about this:
if val == nil {
return sql.NullFloat64{}
}
return db.MakeFloat(val.Value)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -275,8 +304,7 @@ func (s *HandlersTestSuite) TestCreateCbsdWithoutAllRequiredParams() { | |||
e := echo.New() | |||
obsidianHandlers := cbsd.GetHandlers() | |||
payload := &models.MutableCbsd{ | |||
Capabilities: models.Capabilities{ | |||
AntennaGain: to_pointer.Float(1), | |||
Capabilities: &models.Capabilities{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why builder is not used here? (while it is used for same type just a few lines above) It's a bit inconsistent
"magma/dp/cloud/go/services/dp/obsidian/models" | ||
"magma/dp/cloud/go/services/dp/obsidian/to_pointer" | ||
|
||
"github.com/stretchr/testify/assert" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
func TestCbsdFromBackendWithEmptyFrequencies(t *testing.T) { | ||
details := b.NewDetailedProtoCbsdBuilder( | ||
b.NewCbsdProtoPayloadBuilder()).Details | ||
details.Data.Preferences.FrequenciesMhz = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it not done with builder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}, { | ||
name: "Should validate antenna gain", | ||
data: newMutableCbsd(withAntennaGain(nil)), | ||
expectedError: "antenna_gain in body is required", | ||
}, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding some tests to validate installation params?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, validated height type since this is the only enum
@@ -46,6 +47,16 @@ type MutableCbsd struct { | |||
DesiredState *DBCbsdState | |||
} | |||
|
|||
type EnodebdPayload struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this exported? (It is unused)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
func (c *cbsdManagerInTransaction) checkIfCbsdExists(networkId string, id int64) error { | ||
_, err := db.NewQuery(). | ||
func (c *cbsdManagerInTransaction) enodebdUpdateCbsd(data *DBCbsd) error { | ||
mask := db.NewIncludeMask("id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a broader mask, so that comparison of installation params is possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as agreed, will do in a later pr
e8e3fbd
to
291b8ec
Compare
@magma/approvers-orc8r please have a look at this PR. The orc8r part affected is the SQL LOCKER bit in sqorc library |
@maxhbr |
@maxhbr Can you provide review for this so we can merge? |
@magma/approvers-orc8r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The orc8r part loos good
Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com>
Not all sql dialects support locking feature (SELECT FOR UPDATE), so in order to use locking for different dialects, a locker interface was introduced. Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com>
Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com>
291b8ec
to
a821237
Compare
* feat(dp): CBSD update modification Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * chore(dp): Add lock to db framework Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com> * chore(orc8r): Add sql locker to sqorc lib Not all sql dialects support locking feature (SELECT FOR UPDATE), so in order to use locking for different dialects, a locker interface was introduced. Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com> * fixed tests Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * moved pointer converters Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * fixes Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> Co-authored-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> Co-authored-by: Kuba Marciniszyn <kuba@freedomfi.com>
* feat(dp): CBSD update modification Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * chore(dp): Add lock to db framework Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com> * chore(orc8r): Add sql locker to sqorc lib Not all sql dialects support locking feature (SELECT FOR UPDATE), so in order to use locking for different dialects, a locker interface was introduced. Signed-off-by: Kuba Marciniszyn <kuba@freedomfi.com> * fixed tests Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * moved pointer converters Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> * fixes Signed-off-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> Co-authored-by: Wojciech Sadowy <wojciech.sadowy@freedomfi.com> Co-authored-by: Kuba Marciniszyn <kuba@freedomfi.com>
feat(dp): Enodebd triggered update
Summary
DP now has two grpc methods to update a cbsd (UserUpdateCbsd and EnodebdUpdateCbsd)
The separation was needed for the purpose of single-step registration (under development). Enodebd needs to be able to update a cbsd separately with installation param, radio category and single_step_enabled flag.
EnodebdUpdateCbsd receives single-step related information from enodebd and updates the cbsd in the db by calling the storage side Update method.
Introduced data builders for tests to make writing mocked entities and models easier
Refactored tests
Updated protos and swaggers
Introduced select for update in the sqorc library
Test Plan
All tests related to Cbsd CRUD have been refactored, new tests were added.