Skip to content

Commit

Permalink
feat(evpn): enable tls on godpu
Browse files Browse the repository at this point in the history
Signed-off-by: Atul Patel <Atul.Patel@intel.com>
  • Loading branch information
atulpatel261194 committed May 12, 2024
1 parent e4af793 commit 8993f64
Show file tree
Hide file tree
Showing 25 changed files with 301 additions and 86 deletions.
6 changes: 4 additions & 2 deletions cmd/inventory/inventory-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@ import (
// NewGetCommand returns the inventory get command
func NewGetCommand() *cobra.Command {
var (
addr string
addr string
tlsFiles string

Check warning on line 20 in cmd/inventory/inventory-get.go

View check run for this annotation

Codecov / codecov/patch

cmd/inventory/inventory-get.go#L19-L20

Added lines #L19 - L20 were not covered by tests
)
cmd := &cobra.Command{
Use: "get",
Aliases: []string{"g"},
Short: "Gets DPU inventory information",
Args: cobra.NoArgs,
Run: func(_ *cobra.Command, _ []string) {
invClient, err := inventory.New(addr)
invClient, err := inventory.New(addr, tlsFiles)

Check warning on line 28 in cmd/inventory/inventory-get.go

View check run for this annotation

Codecov / codecov/patch

cmd/inventory/inventory-get.go#L28

Added line #L28 was not covered by tests
if err != nil {
log.Fatalf("could create gRPC client: %v", err)
}
Expand All @@ -41,6 +42,7 @@ func NewGetCommand() *cobra.Command {
}
flags := cmd.Flags()
flags.StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
flags.StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 45 in cmd/inventory/inventory-get.go

View check run for this annotation

Codecov / codecov/patch

cmd/inventory/inventory-get.go#L45

Added line #L45 was not covered by tests
return cmd
}

Expand Down
4 changes: 3 additions & 1 deletion cmd/ipsec/ipsec-stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import (
// NewStatsCommand returns the ipsec stats command
func NewStatsCommand() *cobra.Command {
var (
addr string
addr string
tlsFiles string

Check warning on line 19 in cmd/ipsec/ipsec-stats.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipsec/ipsec-stats.go#L18-L19

Added lines #L18 - L19 were not covered by tests
)
cmd := &cobra.Command{
Use: "stats",
Expand All @@ -29,6 +30,7 @@ func NewStatsCommand() *cobra.Command {
}
flags := cmd.Flags()
flags.StringVar(&addr, "addr", "localhost:50151", "address or OPI gRPC server")
flags.StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 33 in cmd/ipsec/ipsec-stats.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipsec/ipsec-stats.go#L33

Added line #L33 was not covered by tests
return cmd
}

Expand Down
2 changes: 2 additions & 0 deletions cmd/ipsec/ipsec-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func NewTestCommand() *cobra.Command {
var (
addr string
pingaddr string
tlsFiles string

Check warning on line 19 in cmd/ipsec/ipsec-test.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipsec/ipsec-test.go#L19

Added line #L19 was not covered by tests
)
cmd := &cobra.Command{
Use: "test",
Expand All @@ -30,5 +31,6 @@ func NewTestCommand() *cobra.Command {
flags := cmd.Flags()
flags.StringVar(&addr, "addr", "localhost:50151", "address or OPI gRPC server")
flags.StringVar(&pingaddr, "pingaddr", "localhost", "address of other tunnel end to Ping")
flags.StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 34 in cmd/ipsec/ipsec-test.go

View check run for this annotation

Codecov / codecov/patch

cmd/ipsec/ipsec-test.go#L34

Added line #L34 was not covered by tests
return cmd
}
22 changes: 17 additions & 5 deletions cmd/network/evpn-bridge-port.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ func CreateBridgePort() *cobra.Command {
var mac string
var bridgePortType string
var logicalBridges []string
var tlsFiles string

Check warning on line 25 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L25

Added line #L25 was not covered by tests

cmd := &cobra.Command{
Use: "create-bp",
Short: "Create a bridge port",
Long: "Create a BridgePort with the specified name, MAC address, type, and VLAN IDs",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewBridgePort(addr)
evpnClient, err := network.NewBridgePort(addr, tlsFiles)

Check warning on line 33 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L33

Added line #L33 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -50,6 +51,7 @@ func CreateBridgePort() *cobra.Command {
cmd.Flags().StringVarP(&bridgePortType, "type", "t", "", "Specify the type (access or trunk)")
cmd.Flags().StringSliceVar(&logicalBridges, "logicalBridges", []string{}, "Specify VLAN IDs (multiple values supported)")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 54 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L54

Added line #L54 was not covered by tests

if err := cmd.MarkFlagRequired("mac"); err != nil {
log.Fatalf("Error marking flag as required: %v", err)
Expand All @@ -73,14 +75,15 @@ func DeleteBridgePort() *cobra.Command {
var addr string
var name string
var allowMissing bool
var tlsFiles string

Check warning on line 78 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L78

Added line #L78 was not covered by tests

cmd := &cobra.Command{
Use: "delete-bp",
Short: "Delete a bridge port",
Long: "Delete a BridgePort with the specified name",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewBridgePort(addr)
evpnClient, err := network.NewBridgePort(addr, tlsFiles)

Check warning on line 86 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L86

Added line #L86 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -98,6 +101,7 @@ func DeleteBridgePort() *cobra.Command {
cmd.Flags().StringVarP(&name, "name", "n", "", "Specify the name of the BridgePort")
cmd.Flags().BoolVarP(&allowMissing, "allowMissing", "a", false, "Specify if missing allowed")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 104 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L104

Added line #L104 was not covered by tests

return cmd
}
Expand All @@ -106,14 +110,15 @@ func DeleteBridgePort() *cobra.Command {
func GetBridgePort() *cobra.Command {
var addr string
var name string
var tlsFiles string

Check warning on line 113 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L113

Added line #L113 was not covered by tests

cmd := &cobra.Command{
Use: "get-bp",
Short: "Show details of a bridge port",
Long: "Show details of a BridgePort with the specified name",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewBridgePort(addr)
evpnClient, err := network.NewBridgePort(addr, tlsFiles)

Check warning on line 121 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L121

Added line #L121 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -131,6 +136,7 @@ func GetBridgePort() *cobra.Command {

cmd.Flags().StringVarP(&name, "name", "n", "", "Specify the name of the BridgePort")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 139 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L139

Added line #L139 was not covered by tests

if err := cmd.MarkFlagRequired("name"); err != nil {
log.Fatalf("Error marking flag as required: %v", err)
Expand All @@ -143,13 +149,14 @@ func ListBridgePorts() *cobra.Command {
var addr string
var pageSize int32
var pageToken string
var tlsFiles string

Check warning on line 152 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L152

Added line #L152 was not covered by tests

cmd := &cobra.Command{
Use: "list-bps",
Short: "Show details of all bridge ports",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewBridgePort(addr)
evpnClient, err := network.NewBridgePort(addr, tlsFiles)

Check warning on line 159 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L159

Added line #L159 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand Down Expand Up @@ -179,6 +186,8 @@ func ListBridgePorts() *cobra.Command {
cmd.Flags().Int32VarP(&pageSize, "pagesize", "s", 0, "Specify page size")
cmd.Flags().StringVarP(&pageToken, "pagetoken", "t", "", "Specify the token")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 190 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L189-L190

Added lines #L189 - L190 were not covered by tests
return cmd
}

Expand All @@ -188,14 +197,15 @@ func UpdateBridgePort() *cobra.Command {
var name string
var updateMask []string
var allowMissing bool
var tlsFiles string

Check warning on line 200 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L200

Added line #L200 was not covered by tests

cmd := &cobra.Command{
Use: "update-bp",
Short: "Update the bridge port",
Long: "updates the Bridge Port with updated mask",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewBridgePort(addr)
evpnClient, err := network.NewBridgePort(addr, tlsFiles)

Check warning on line 208 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L208

Added line #L208 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -215,5 +225,7 @@ func UpdateBridgePort() *cobra.Command {
cmd.Flags().StringSliceVar(&updateMask, "update-mask", nil, "update mask")
cmd.Flags().BoolVarP(&allowMissing, "allowMissing", "a", false, "allow the missing")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 229 in cmd/network/evpn-bridge-port.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-bridge-port.go#L228-L229

Added lines #L228 - L229 were not covered by tests
return cmd
}
24 changes: 19 additions & 5 deletions cmd/network/evpn-logical-brige.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func CreateLogicalBridge() *cobra.Command {
var vlanID uint32
var vni uint32
var vtep string
var tlsFiles string

Check warning on line 25 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L25

Added line #L25 was not covered by tests

cmd := &cobra.Command{
Use: "create-lb",
Expand All @@ -30,7 +31,7 @@ func CreateLogicalBridge() *cobra.Command {
Run: func(_ *cobra.Command, _ []string) {
var vniparam *uint32
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewLogicalBridge(addr)
evpnClient, err := network.NewLogicalBridge(addr, tlsFiles)

Check warning on line 34 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L34

Added line #L34 was not covered by tests
if err != nil {
log.Fatalf("could create gRPC client: %v", err)
}
Expand All @@ -54,6 +55,7 @@ func CreateLogicalBridge() *cobra.Command {
cmd.Flags().Uint32VarP(&vlanID, "vlan-id", "v", 0, "Specify the VLAN ID")
cmd.Flags().Uint32VarP(&vni, "vni", "i", 0, "Specify the VNI")
cmd.Flags().StringVar(&vtep, "vtep", "", "VTEP IP address")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 58 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L58

Added line #L58 was not covered by tests

if err := cmd.MarkFlagRequired("addr"); err != nil {
log.Fatalf("Error marking flag as required: %v", err)
Expand All @@ -75,14 +77,15 @@ func DeleteLogicalBridge() *cobra.Command {
var addr string
var name string
var allowMissing bool
var tlsFiles string

Check warning on line 80 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L80

Added line #L80 was not covered by tests

cmd := &cobra.Command{
Use: "delete-lb",
Short: "Delete a logical bridge",
Long: "Delete a logical bridge with the specified name",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewLogicalBridge(addr)
evpnClient, err := network.NewLogicalBridge(addr, tlsFiles)

Check warning on line 88 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L88

Added line #L88 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -100,6 +103,7 @@ func DeleteLogicalBridge() *cobra.Command {
cmd.Flags().StringVarP(&name, "name", "n", "", "Specify the name of the BridgePort")
cmd.Flags().BoolVarP(&allowMissing, "allowMissing", "a", false, "Specify allow missing")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 106 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L106

Added line #L106 was not covered by tests

if err := cmd.MarkFlagRequired("name"); err != nil {
log.Fatalf("Error marking flag as required: %v", err)
Expand All @@ -111,14 +115,15 @@ func DeleteLogicalBridge() *cobra.Command {
func GetLogicalBridge() *cobra.Command {
var addr string
var name string
var tlsFiles string

Check warning on line 118 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L118

Added line #L118 was not covered by tests

cmd := &cobra.Command{
Use: "get-lb",
Short: "Show details of a logical bridge",
Long: "Show details of a logical bridge with the specified name",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewLogicalBridge(addr)
evpnClient, err := network.NewLogicalBridge(addr, tlsFiles)

Check warning on line 126 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L126

Added line #L126 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -136,6 +141,8 @@ func GetLogicalBridge() *cobra.Command {

cmd.Flags().StringVarP(&name, "name", "n", "", "Specify the name of the BridgePort")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 145 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L144-L145

Added lines #L144 - L145 were not covered by tests
if err := cmd.MarkFlagRequired("name"); err != nil {
log.Fatalf("Error marking flag as required: %v", err)
}
Expand All @@ -148,12 +155,14 @@ func ListLogicalBridges() *cobra.Command {
var addr string
var pageSize int32
var pageToken string
var tlsFiles string

Check warning on line 159 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L158-L159

Added lines #L158 - L159 were not covered by tests
cmd := &cobra.Command{
Use: "list-lbs",
Short: "Show details of all logical bridges",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewLogicalBridge(addr)
evpnClient, err := network.NewLogicalBridge(addr, tlsFiles)

Check warning on line 165 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L165

Added line #L165 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand Down Expand Up @@ -185,6 +194,8 @@ func ListLogicalBridges() *cobra.Command {
cmd.Flags().Int32VarP(&pageSize, "pagesize", "s", 0, "Specify page size")
cmd.Flags().StringVarP(&pageToken, "pagetoken", "t", "", "Specify the token")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 198 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L197-L198

Added lines #L197 - L198 were not covered by tests
return cmd
}

Expand All @@ -194,12 +205,14 @@ func UpdateLogicalBridge() *cobra.Command {
var name string
var allowMissing bool
var updateMask []string
var tlsFiles string

Check warning on line 209 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L208-L209

Added lines #L208 - L209 were not covered by tests
cmd := &cobra.Command{
Use: "update-lb",
Short: "update the logical bridge",
Run: func(_ *cobra.Command, _ []string) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
evpnClient, err := network.NewLogicalBridge(addr)
evpnClient, err := network.NewLogicalBridge(addr, tlsFiles)

Check warning on line 215 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L215

Added line #L215 was not covered by tests
if err != nil {
log.Fatalf("could not create gRPC client: %v", err)
}
Expand All @@ -217,6 +230,7 @@ func UpdateLogicalBridge() *cobra.Command {
cmd.Flags().StringSliceVar(&updateMask, "update-mask", nil, "update mask")
cmd.Flags().StringVar(&addr, "addr", "localhost:50151", "address of OPI gRPC server")
cmd.Flags().BoolVarP(&allowMissing, "allowMissing", "a", false, "Specify allow missing")
cmd.Flags().StringVar(&tlsFiles, "tls", "", "TLS files in client_cert:client_key:ca_cert format.")

Check warning on line 233 in cmd/network/evpn-logical-brige.go

View check run for this annotation

Codecov / codecov/patch

cmd/network/evpn-logical-brige.go#L233

Added line #L233 was not covered by tests

return cmd
}
Loading

0 comments on commit 8993f64

Please sign in to comment.