Skip to content

Conversation

@sven-rosenzweig
Copy link
Contributor

No description provided.

@sven-rosenzweig sven-rosenzweig force-pushed the feat/iosxrv2 branch 2 times, most recently from 120c4a7 to ff39cee Compare October 1, 2025 15:36
@sven-rosenzweig
Copy link
Contributor Author

Waiting for #30 to be merged.

@hardikdr hardikdr added the area/metal-automation Automation processes within the Metal project. label Oct 14, 2025
@hardikdr hardikdr added this to Roadmap Oct 14, 2025
@sven-rosenzweig sven-rosenzweig force-pushed the feat/iosxrv2 branch 2 times, most recently from 32662d3 to 35d7a78 Compare October 31, 2025 16:10
Some network devices do not have TLS configured on their side, requiring
the use of insecure credentials. To support these cases, this change
disables transport security enforcement when insecure credentials are
used.

Note: This option is intended for development and testing purposes only.
Refactor the Provider to depend on a Client interface instead of a concrete
implementation. This simplifies testing and mocking by allowing the Client
itself to be mocked, rather than individual gRPC calls.
@sven-rosenzweig sven-rosenzweig force-pushed the feat/iosxrv2 branch 2 times, most recently from f3ee185 to 0895369 Compare November 13, 2025 14:08
@github-actions
Copy link

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/internal/deviceutil 34.78% (-1.04%) 👎
github.com/ironcore-dev/network-operator/internal/provider/cisco/gnmiext/v2 91.38% (ø)
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr 42.70% (+42.70%) 🌟
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 11.12% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/internal/deviceutil/deviceutil.go 34.78% (-1.04%) 69 (+2) 24 45 (+2) 👎
github.com/ironcore-dev/network-operator/internal/provider/cisco/gnmiext/v2/client.go 89.36% (ø) 141 126 15
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr/intf.go 28.00% (+28.00%) 25 (+25) 7 (+7) 18 (+18) 🌟
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr/provider.go 48.44% (+48.44%) 64 (+64) 31 (+31) 33 (+33) 🌟
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/intf.go 10.14% (ø) 69 7 62
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/provider.go 0.11% (ø) 889 1 888

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/ironcore-dev/network-operator/internal/provider/cisco/gnmiext/v2/client_test.go
  • github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr/intf_test.go
  • github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr/provider_test.go

@sven-rosenzweig sven-rosenzweig marked this pull request as ready for review November 13, 2025 15:14
@sven-rosenzweig sven-rosenzweig requested a review from a team as a code owner November 13, 2025 15:14
}

func (a *auth) RequireTransportSecurity() bool { return true }
func (a *auth) RequireTransportSecurity() bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we could just always use false here as this is only called with the insecure transport credentials.

Comment on lines 66 to +68
// Client is a gNMI client offering convenience methods for device configuration
// using gNMI.
type Client struct {
type ClientObj struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Client is a gNMI client offering convenience methods for device configuration
// using gNMI.
type Client struct {
type ClientObj struct {
type client struct {

Would move the comment to the Client interface definition and make the client implementation lowercase (unexported).

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: seems like this file is inconsistency indented. Maybe re-indent.

)

// YANG has an empty type that is represented as a JSON array with a single null value. Whenever the key is present in YANG, it should evaluate to true.
type Empty bool
Copy link
Contributor

Choose a reason for hiding this comment

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

This type is already contained in the gnmiext package and can be used from there.

return nil, nil
}

type PhisIf struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type PhisIf struct {
type PhysIf struct {

// (fixme): for the moment it is enought to keep this static
// option1: extend existing interface spec
// option2: create a custom iosxr config
physif.Shutdown = Empty(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
physif.Shutdown = Empty(false)
physif.Shutdown = Empty(false)
if req.Interface.Spec.AdminState == v1alpha1.InterfaceAdminStateDown {
physif.Shutdown = Empty(true)
}

return p.conn.Close()
}

func (p *Provider) EnsureInterface(ctx context.Context, req *provider.InterfaceRequest) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently only Physical Interfaces are supported. Maybe we should return an error of the Type doesn't match.

if err != nil {
return fmt.Errorf("failed to create interface %s: %w", req.Interface.Spec.Name, err)
}
fmt.Printf("Interface %s created successfully\n", req.Interface.Spec.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fmt.Printf("Interface %s created successfully\n", req.Interface.Spec.Name)

return nil
}

err = p.client.Patch(ctx, physif)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
err = p.client.Patch(ctx, physif)
return p.client.Update(ctx, physif)

I think I would just always use a Update, then you also don't need the check above.

Comment on lines +147 to +155
providerStatus := provider.InterfaceStatus{
OperStatus: true,
}

if stateMapping[state.State] != StateUp {
providerStatus.OperStatus = false
}

return providerStatus, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
providerStatus := provider.InterfaceStatus{
OperStatus: true,
}
if stateMapping[state.State] != StateUp {
providerStatus.OperStatus = false
}
return providerStatus, nil
return provider.InterfaceStatus{
OperStatus: state.State == StateUp,
}, nil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metal-automation Automation processes within the Metal project.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants