Add NewAmfRanDefault function to properly initialize log#745
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a standard constructor for context.AmfRan that pre-initializes its logger, then updates NGAP/GMM tests and dispatcher logic to use that constructor so ran.Log is not nil.
Changes:
- Add
context.NewAmfRanDefault()to create anAmfRanwithLoginitialized tologger.NgapLog. - Update multiple tests to construct RAN contexts via
NewAmfRanDefault()instead of ad-hoc&context.AmfRan{...}. - Update
ngap.DispatchLbto useNewAmfRanDefault()in the “GnbIpAddr but no GnbId” path, and simplify error logging inDispatchNgapMsgto useran.Logdirectly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| context/amf_ran.go | Adds NewAmfRanDefault() to ensure AmfRan.Log is initialized by default. |
| ngap/dispatcher.go | Uses the new constructor in one dispatch path; simplifies logging by removing fallback logger branches. |
| ngap/dispatcher_test.go | Updates dispatcher tests to use NewAmfRanDefault() instead of a noop zap logger. |
| ngap/handler_test.go | Replaces direct AmfRan allocations (with zap noop loggers) with NewAmfRanDefault(). |
| ngap/message/build_test.go | Switches test RAN creation to NewAmfRanDefault() and sets AnType explicitly. |
| gmm/handler_test.go | Updates GMM tests to construct AmfRan via NewAmfRanDefault() and then set required fields. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
gab-arrobo
force-pushed
the
add-NewAmfRanDefault
branch
from
July 10, 2026 06:21
791c671 to
6a5b2d3
Compare
sureshmarikkannu
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.