Skip to content

Use accessors (new, get, set) instead of direct field access#715

Merged
gab-arrobo merged 2 commits into
omec-project:mainfrom
gab-arrobo:use-accessors
Jun 11, 2026
Merged

Use accessors (new, get, set) instead of direct field access#715
gab-arrobo merged 2 commits into
omec-project:mainfrom
gab-arrobo:use-accessors

Conversation

@gab-arrobo

Copy link
Copy Markdown
Contributor

Also add a couple unit tests

Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates AMF code to prefer OpenAPI model constructors/accessors (New*, Get*, Set*) over direct struct-field access, and adds/updates unit tests to validate multipart payload handling and RAT type behavior.

Changes:

  • Refactor multiple call sites to use OpenAPI model constructors and setter/getter methods instead of direct field mutation.
  • Adjust UE context / event exposure logic to construct nested model objects via accessors.
  • Add/extend unit tests for SM context creation multipart payloads and RAT type upgrade behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
producer/ue_context.go Renames UE context procedures to unexported helpers and switches several model constructions to New*/Set*.
producer/event_exposure.go Uses constructors/setters for event subscription responses and refactors expiry-duration calculation helper.
producer/callback/callback_test.go Updates callback tests to use model constructors and decode into allocated structs.
ngap/message/send.go Uses NewNgApCause(...) constructor.
ngap/message/send_test.go.test Removes legacy test file.
ngap/message/build_test.go Uses constructors/setters for subscription data setup in tests.
ngap/handler.go Uses NewNgApCause(...) in multiple NGAP handlers.
nfregistration/nf_registration_test.go Updates mocks to return NewNFProfileWithDefaults().
gmm/rat_type_integration_test.go Adds an integration-style test validating RAT type upgrade from NGSetup RATInformation.
gmm/handler.go Uses constructors/setters for N1/N2 payload references, AllowedNssai, and resynchronization info.
gmm/handler_test.go Updates tests to use setters/constructors for location and S-NSSAI.
context/ran_ue.go Uses setters for NR location nested fields and N3GA location fields.
context/amf_ue.go Uses constructors for nested JSON data containers during UE marshaling.
consumer/ue_authentication.go Uses NewPlmnIdNid(...) constructor.
consumer/sm_context.go Refactors SM context create/update/release payload building to use setters; threads requestType into create request builder.
consumer/sm_context_test.go Adds SM context create test verifying requestType + N1 multipart payload, plus multipart helper improvements.
consumer/nf_management.go Uses constructors/setters for default notification subscription and returns default NFProfile on error paths.
consumer/communication.go Uses NewN1MessageContainer(...) constructor for RegRequest.
consumer/communication_test.go Uses NewN2InfoContent(...) in UE context transfer response test.
consumer/am_policy.go Uses NewPlmnIdNid(...) for ServingPlmn.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread producer/event_exposure.go Outdated
Comment thread producer/ue_context.go Outdated
Comment thread gmm/rat_type_integration_test.go Outdated
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
@gab-arrobo
gab-arrobo merged commit 27842bb into omec-project:main Jun 11, 2026
12 checks passed
@gab-arrobo
gab-arrobo deleted the use-accessors branch June 11, 2026 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants