lfcli_base.py: add shared resolve_port_to_ipv4() to LFCliBase - #365
Merged
haricharan-candela merged 2 commits intoAug 25, 2026
Merged
Conversation
python3 lf_interop_zoom.py --duration 1 --lanforge_ip 192.168.245.117 --signin_email <zoom_email> --signin_passwd <zoom_passwd> --participants 3 --audio --video --upstream_port <upstream_ip>/<upstream_port> --zoom_host 1.13 --resources 1.13,1.12,1.25 --api_stats_collection --env_file .env Signed-off-by: Narayana-CT <narayana.pinapatruni@candelatech.com>
haricharan-candela
approved these changes
Aug 18, 2026
haricharan-candela
self-requested a review
August 18, 2026 08:29
Owner
|
On 8/18/26 22:07, Tarun wrote:
***@***.**** commented on this pull request.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
In py-json/LANforge/lfcli_base.py <#365 (comment)>:
> + logger.error(
+ "resolve_port_to_ipv4: port '%s' resolved to %s; the port is down or has "
+ "no IP assigned.", port, resolved_ip)
Please avoid implementation details, just try to keep generic error cause message.
It is important to give enough information in logging messages that our
engineers can understand root cause. So I do not agree with the comment above.
Thanks,
Ben
…
—
Reply to this email directly, view it on GitHub
<#365?email_source=notifications&email_token=AACHNKSMNTGK5HUT45QYQ7D5KUYX3A5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOJWHA2TQOJVGU22M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussion_r3810196879>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AACHNKWOIHSDZPDJ5QWI2MD5KUYX3AVCNFSNUABFKJSXA33TNF2G64TZHMYTANRQGQ3TINZQHNEXG43VMU5TKMJXHE3DAMBSGUYKC5QC>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
--
Ben Greear ***@***.***>
Candela Technologies Inc http://www.candelatech.com
|
Owner
|
On 8/18/26 22:05, Tarun wrote:
***@***.**** commented on this pull request.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
In py-json/LANforge/lfcli_base.py <#365 (comment)>:
> + logger.error(
+ "resolve_port_to_ipv4: /port/%s/%s/%s response is not in the expected "
+ "format (%s). Data received: %s", shelf, resource, port_name, e, response)
Please avoid implementation details or url related info in the logging.
No, keep the details in the logging messages.
Thanks,
Ben
…
—
Reply to this email directly, view it on GitHub
<#365?email_source=notifications&email_token=AACHNKWPNCE7KSK3OO26NYL5KUYRLA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOJWHA2TQMRQHA42M4TFMFZW63VKON2WE43DOJUWEZLEUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussion_r3810190413>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AACHNKUT2R3JQF5R4FIL2N35KUYRLAVCNFSNUABFKJSXA33TNF2G64TZHMYTANRQGQ3TINZQHNEXG43VMU5TKMJXHE3DAMBSGUYKC5QC>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
--
Ben Greear ***@***.***>
Candela Technologies Inc http://www.candelatech.com
|
haricharan-candela
self-requested a review
August 19, 2026 19:34
haricharan-candela
approved these changes
Aug 19, 2026
smileyrekiere
approved these changes
Aug 21, 2026
tarun-candela
approved these changes
Aug 21, 2026
tarun-candela
left a comment
Collaborator
There was a problem hiding this comment.
LGTM! Assuming you have done enough testing.
haricharan-candela
approved these changes
Aug 23, 2026
goyalsaurabh06
approved these changes
Aug 24, 2026
goyalsaurabh06
self-requested a review
August 24, 2026 05:59
…alid-port log message
Verified CLI:
python3 lf_interop_zoom.py --duration 1
--lanforge_ip 192.168.245.117
--signin_email <zoom_email> --signin_passwd <zoom_passwd>
--participants 3 --audio --video
--upstream_port <upstream_ip>/<upstream_port>
--zoom_host 1.13
--resources 1.13,1.12,1.25
--api_stats_collection --env_file .env
Signed-off-by: Narayana-CT <narayana.pinapatruni@candelatech.com>
haricharan-candela
approved these changes
Aug 24, 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.
Summary
Adds
resolve_port_to_ipv4()toLFCliBase, a shared helper that resolves aLANforge port to its IPv4 address.
The same port-to-IP logic is currently reimplemented in roughly 15 scripts
(
lf_ftp.py,lf_webpage.py,DeviceConfig.py,test_l3.py,lf_multi_traffic.py,lf_interop_*.py, and several underreal_application_tests/), each with slightlydifferent behaviour and error handling. This puts a single implementation on the
base class so those copies can be retired incrementally.
Behaviour
The method accepts:
eth1(shelf and resource default to1.1)1.1.eth1.It returns the resolved IPv4 address as a string, or
Nonewhen the port cannotbe resolved — the port does not exist, is down, has no address assigned, or the
manager response is not in the expected shape. Every failure path logs the reason
before returning.
Error handling stays with the caller: the helper reports what went wrong and hands
control back, so the calling script decides whether to continue, clean up, record a
failure in its report, or stop. That keeps the decision — and the user-facing
messaging — in the script that owns the test.
Input that is empty or not a string is rejected up front and logged, so a bad
argument surfaces as a clear message rather than an attribute error deeper in.
Verification
Exercised against LANforge manager
192.168.245.117eth1,eth0,eth21.1.eth1192.168.245.233,8.8.8.80.0.0.0eth3(admin down)None, reason loggedeth99(does not exist)None, reason logged'',None,0,[],{}None, reason logged123,1.5,['eth1'],b'eth1'None, reason loggedVerified CLI:
python3 lf_interop_zoom.py --duration 1
--lanforge_ip 192.168.245.117
--signin_email <zoom_email> --signin_passwd <zoom_passwd> --participants 3 --audio --video
--upstream_port <upstream_ip>/<upstream_port>
--zoom_host 1.13
--resources 1.13,1.12,1.25
--api_stats_collection --env_file .env