open-amt-cloud-toolkit / rpc-go

The Remote Provisioning Client (RPC) communicates with the Manageability Engine Interface (MEI) and Remote Provisioning Service (RPS) interfaces.
https://open-amt-cloud-toolkit.github.io/docs/
Apache License 2.0
10 stars 15 forks source link

feat(cli): amtinfo command add amt ipaddr and osipaddr #560

Closed tongsean9807 closed 2 months ago

tongsean9807 commented 3 months ago

Add os ipaddress to amtinfo command. amtinfo command now show amt ipaddrss and os ipaddress. os ipadress select by mapping to mac address from amt.

Resolves: #467

tongsean9807 commented 3 months ago

Output: image

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 71.69811% with 15 lines in your changes missing coverage. Please review.

Project coverage is 71.29%. Comparing base (650935d) to head (93ba577). Report is 250 commits behind head on main.

Files Patch % Lines
internal/local/info.go 71.15% 10 Missing and 5 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #560 +/- ## =========================================== - Coverage 83.21% 71.29% -11.92% =========================================== Files 32 41 +9 Lines 4265 4132 -133 =========================================== - Hits 3549 2946 -603 - Misses 576 919 +343 - Partials 140 267 +127 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tongsean9807 commented 3 months ago

Hi,

I have move the GetOSIPAddress() to internal/local/info.go Let me know what other changes is needed.

I will squash them after fixing all the changes.

Thank you

rsdmike commented 2 months ago

@tongsean9807 looks good to me. You think you can muster up a unit test or two? Additionally, the commit message should really be feat: since its a new capability added to the cli.

tongsean9807 commented 2 months ago

Hi,

I have changed the space to tab, which causes the misalignment when viewing in github. I have added the unittest but I am unable to overwrite the net.interface. Let me know if there are better ways to improve the unittest.

Thank you

rsdmike commented 2 months ago

Hi @tongsean9807 , Thank you for adding the unit test! I should have sent this to you, we have a NetEnumerator https://github.com/open-amt-cloud-toolkit/rpc-go/blob/bacb0ebc9fff12a92ccaeae5ddca8123f717fe2a/internal/flags/flags.go#L30-L31 that you can use to abstract the net.Interfaces calls.

Can take a look at https://github.com/open-amt-cloud-toolkit/rpc-go/blob/bacb0ebc9fff12a92ccaeae5ddca8123f717fe2a/internal/flags/flags_test.go#L115 for an example of how it is used in tests.

For the code that uses the NetEnumerator check out: https://github.com/open-amt-cloud-toolkit/rpc-go/blob/bacb0ebc9fff12a92ccaeae5ddca8123f717fe2a/internal/flags/maintenance.go#L196.

tongsean9807 commented 2 months ago

Hi,

I have add positive and negative unit test. And use the net enumerator from flags package.

Thank you for the pointing out the net enumerator.

Regards, Sean

tongsean9807 commented 2 months ago

Hi @rsdmike,

I hope you're doing well. I want to follow up on this PR. I have made the changes. Have you had a chance to review it?

Thank you

rsdmike commented 2 months ago

Hi @rsdmike,

I hope you're doing well. I want to follow up on this PR. I have made the changes. Have you had a chance to review it?

Thank you

Thanks for following up, looks good to me! We'll get it merged.