-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add network interface capability #457
Draft
sandersms
wants to merge
5
commits into
opiproject:main
Choose a base branch
from
sandersms:basic-network-intf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cdd8ef2
feat: add network interface capability
sandersms f59fbf6
fix(godpu): update dockerfile for new alpine and golang versions
sandersms 7b06a2d
fix(godpu): fix docker-compose evpn test command syntax
sandersms 19a450e
fix(godpu): update alpine versions in docker-compose
sandersms b654131
fix(ci): correct opi-test timeout by waiting after start
sandersms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (c) 2025 Dell Inc, or its subsidiaries. | ||
|
||
// Package network implements the network related CLI commands | ||
package netintf | ||
|
||
import ( | ||
// "log" | ||
// "time" | ||
|
||
// "github.com/opiproject/godpu/cmd/common" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
|
||
// ListNetInterfaces lists all Network Interface details from OPI server | ||
func ListNetInterfaces() *cobra.Command { | ||
var pageSize int32 | ||
var pageToken string | ||
|
||
cmd := &cobra.Command{ | ||
Use: "list-net-interfaces", | ||
Short: "List the network interfaces", | ||
Run: func(c *cobra.Command, _ []string) { | ||
// TODO: Add processing for Network Interface List | ||
// ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) | ||
|
||
// tlsFiles, err := c.Flags().GetString(common.TLSFiles) | ||
// cobra.CheckErr(err) | ||
|
||
// addr, err := c.Flags().GetString(common.AddrCmdLineArg) | ||
// cobra.CheckErr(err) | ||
|
||
// evpnClient, err := network.NewLogicalBridge(addr, tlsFiles) | ||
// if err != nil { | ||
// log.Fatalf("could not create gRPC client: %v", err) | ||
// } | ||
// defer cancel() | ||
|
||
// for { | ||
// resp, err := evpnClient.ListLogicalBridges(ctx, pageSize, pageToken) | ||
// if err != nil { | ||
// log.Fatalf("Failed to get items: %v", err) | ||
// } | ||
// Process the server response | ||
// log.Println("List Network Interfaces:") | ||
// for _, lb := range resp.NetInterfaces { | ||
// log.Println("Interface with: ") | ||
// PrintLB(lb) | ||
// } | ||
|
||
// Check if there are more pages to retrieve | ||
// if resp.NextPageToken == "" { | ||
// No more pages, break the loop | ||
// break | ||
// } | ||
// Update the page token for the next request | ||
// pageToken = resp.NextPageToken | ||
// } | ||
}, | ||
} | ||
|
||
cmd.Flags().Int32VarP(&pageSize, "pagesize", "s", 0, "Specify page size") | ||
cmd.Flags().StringVarP(&pageToken, "pagetoken", "t", "", "Specify the token") | ||
|
||
return cmd | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (c) 2022-2023 Intel Corporation, or its subsidiaries. | ||
// Copyright (c) 2024 Dell Inc, or its subsidiaries. | ||
|
||
// Package network implements the network related CLI commands | ||
package network | ||
|
||
import ( | ||
"log" | ||
"time" | ||
|
||
"github.com/opiproject/godpu/cmd/common" | ||
"github.com/opiproject/godpu/cmd/network/netintf" | ||
"github.com/opiproject/godpu/cmd/network/evpn" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// NewNetworkCommand tests the Network functionality command | ||
func NewNetworkCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "network", | ||
Aliases: []string{"g"}, | ||
Short: "Tests DPU networking functionality", | ||
Args: cobra.NoArgs, | ||
Run: func(cmd *cobra.Command, _ []string) { | ||
err := cmd.Help() | ||
if err != nil { | ||
log.Fatalf("[ERROR] %s", err.Error()) | ||
} | ||
}, | ||
} | ||
|
||
flags := cmd.PersistentFlags() | ||
flags.Duration(common.TimeoutCmdLineArg, 10*time.Second, "timeout for a cmd") | ||
|
||
cmd.AddCommand(NewEvpnCommand()) | ||
cmd.AddCommand(NewNetIntfCommand()) | ||
|
||
return cmd | ||
} | ||
|
||
// NewNetworkCommand tests the Network functionality command | ||
func NewNetIntfCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "intf", | ||
Aliases: []string{"g"}, | ||
Short: "Tests DPU network interface functionality", | ||
Args: cobra.NoArgs, | ||
Run: func(cmd *cobra.Command, _ []string) { | ||
err := cmd.Help() | ||
if err != nil { | ||
log.Fatalf("[ERROR] %s", err.Error()) | ||
} | ||
}, | ||
} | ||
|
||
flags := cmd.PersistentFlags() | ||
flags.Duration(common.TimeoutCmdLineArg, 10*time.Second, "timeout for a cmd") | ||
|
||
cmd.AddCommand(netintf.ListNetInterfaces()) | ||
|
||
return cmd | ||
} | ||
|
||
// NewEvpnCommand tests the EVPN functionality command | ||
func NewEvpnCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "evpn", | ||
Aliases: []string{"g"}, | ||
Short: "Tests DPU evpn functionality", | ||
Args: cobra.NoArgs, | ||
Run: func(cmd *cobra.Command, _ []string) { | ||
err := cmd.Help() | ||
if err != nil { | ||
log.Fatalf("[ERROR] %s", err.Error()) | ||
} | ||
}, | ||
} | ||
// Bridge cli's | ||
cmd.AddCommand(evpn.CreateLogicalBridge()) | ||
cmd.AddCommand(evpn.DeleteLogicalBridge()) | ||
cmd.AddCommand(evpn.GetLogicalBridge()) | ||
cmd.AddCommand(evpn.ListLogicalBridges()) | ||
cmd.AddCommand(evpn.UpdateLogicalBridge()) | ||
// Port cli's | ||
cmd.AddCommand(evpn.CreateBridgePort()) | ||
cmd.AddCommand(evpn.DeleteBridgePort()) | ||
cmd.AddCommand(evpn.GetBridgePort()) | ||
cmd.AddCommand(evpn.ListBridgePorts()) | ||
cmd.AddCommand(evpn.UpdateBridgePort()) | ||
// VRF cli's | ||
cmd.AddCommand(evpn.CreateVRF()) | ||
cmd.AddCommand(evpn.DeleteVRF()) | ||
cmd.AddCommand(evpn.GetVRF()) | ||
cmd.AddCommand(evpn.ListVRFs()) | ||
cmd.AddCommand(evpn.UpdateVRF()) | ||
// SVI cli's | ||
cmd.AddCommand(evpn.CreateSVI()) | ||
cmd.AddCommand(evpn.DeleteSVI()) | ||
cmd.AddCommand(evpn.GetSVI()) | ||
cmd.AddCommand(evpn.ListSVIs()) | ||
cmd.AddCommand(evpn.UpdateSVI()) | ||
|
||
return cmd | ||
} |
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
Check warning
Code scanning / Scorecard
Pinned-Dependencies Medium