-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add network interface capability
Signed-off-by: Mark Sanders <marksanders194@gmail.com>
- Loading branch information
Showing
13 changed files
with
275 additions
and
164 deletions.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
module github.com/opiproject/godpu | ||
|
||
go 1.19 | ||
go 1.22.0 | ||
|
||
toolchain go1.23.4 | ||
|
||
require ( | ||
github.com/PraserX/ipconv v1.2.0 | ||
github.com/go-chi/chi v1.5.5 | ||
github.com/go-ping/ping v1.1.0 | ||
github.com/google/uuid v1.5.0 | ||
github.com/go-chi/chi/v5 v5.2.0 | ||
github.com/go-ping/ping v1.2.0 | ||
github.com/google/uuid v1.6.0 | ||
github.com/lithammer/fuzzysearch v1.1.8 | ||
github.com/onsi/ginkgo/v2 v2.14.0 | ||
github.com/onsi/gomega v1.30.0 | ||
github.com/opiproject/opi-api v0.0.0-20240304222410-5dba226aaa9e | ||
github.com/spf13/cobra v1.8.0 | ||
github.com/stretchr/testify v1.8.4 | ||
go.einride.tech/aip v0.66.0 | ||
golang.org/x/net v0.20.0 | ||
golang.org/x/text v0.14.0 | ||
google.golang.org/grpc v1.60.1 | ||
google.golang.org/protobuf v1.32.0 | ||
github.com/onsi/ginkgo/v2 v2.22.2 | ||
github.com/onsi/gomega v1.36.2 | ||
github.com/opiproject/opi-api v0.0.0-20241209203403-595a3a1a838b | ||
github.com/spf13/cobra v1.8.1 | ||
github.com/stretchr/testify v1.10.0 | ||
go.einride.tech/aip v0.68.1 | ||
golang.org/x/net v0.33.0 | ||
golang.org/x/text v0.21.0 | ||
google.golang.org/grpc v1.69.2 | ||
google.golang.org/protobuf v1.36.1 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/go-logr/logr v1.3.0 // indirect | ||
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/go-logr/logr v1.4.2 // indirect | ||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect | ||
github.com/google/go-cmp v0.6.0 // indirect | ||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect | ||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect | ||
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect | ||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/kr/text v0.2.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/rogpeppe/go-internal v1.9.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/stretchr/objx v0.5.0 // indirect | ||
golang.org/x/sync v0.5.0 // indirect | ||
golang.org/x/sys v0.16.0 // indirect | ||
golang.org/x/tools v0.16.1 // indirect | ||
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect | ||
github.com/stretchr/objx v0.5.2 // indirect | ||
golang.org/x/sync v0.10.0 // indirect | ||
golang.org/x/sys v0.28.0 // indirect | ||
golang.org/x/tools v0.28.0 // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20250102185135-69823020774d // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.