Skip to content

Commit

Permalink
Merge pull request #7 from karimra/update-gribi-protos
Browse files Browse the repository at this point in the history
update to latest gribi protos
  • Loading branch information
karimra authored Dec 8, 2022
2 parents 82e1bc6 + 70a0b37 commit 81e6f22
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 39 deletions.
24 changes: 0 additions & 24 deletions api/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,30 +413,6 @@ func MAC(mac string) func(proto.Message) error {
}
}

// ProgrammedIndex NOTE: used for both NH ProgrammedIndex and NHG ProgrammedId
func ProgrammedIndex(pIndex uint64) func(proto.Message) error {
return func(msg proto.Message) error {
if msg == nil {
return ErrInvalidMsgType
}
switch msg := msg.ProtoReflect().Interface().(type) {
case *gribi_aft.Afts_NextHopKey:
if msg.NextHop == nil {
msg.NextHop = new(gribi_aft.Afts_NextHop)
}
msg.NextHop.ProgrammedIndex = &ywrapper.UintValue{Value: pIndex}
case *gribi_aft.Afts_NextHopGroupKey:
if msg.NextHopGroup == nil {
msg.NextHopGroup = new(gribi_aft.Afts_NextHopGroup)
}
msg.NextHopGroup.ProgrammedId = &ywrapper.UintValue{Value: pIndex}
default:
return fmt.Errorf("option ProgrammedIndex: %w: %T", ErrInvalidMsgType, msg)
}
return nil
}
}

func PushedMplsLabelStack(typ string, label uint64) func(proto.Message) error {
return func(msg proto.Message) error {
if msg == nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func newRootCmd() *cobra.Command {
gApp.RootCmd = &cobra.Command{
Use: "gribic",
Short: "run gRIBI RPCs from the terminal",
PreRun: func(cmd *cobra.Command, args []string) {
PreRun: func(cmd *cobra.Command, _ []string) {
gApp.Config.SetPersistentFlagsFromFile(cmd)
},
PersistentPreRunE: gApp.PreRun,
Expand Down
3 changes: 1 addition & 2 deletions cmd/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright © 2022 Karim Radhouani <[email protected]>
*/
package cmd

Expand All @@ -13,7 +12,7 @@ func newServerCmd() *cobra.Command {
Use: "server",
Aliases: []string{"serve", "s"},
Short: "start a gNMI server",
PreRun: func(cmd *cobra.Command, args []string) {
PreRun: func(cmd *cobra.Command, _ []string) {
gApp.Config.SetLocalFlagsFromFile(cmd)
},
RunE: gApp.RunEServer,
Expand Down
2 changes: 1 addition & 1 deletion cmd/versionUpgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func newVersionUpgradeCmd() *cobra.Command {
Use: "upgrade",
Aliases: []string{"up"},
Short: "upgrade gRIBIc to latest available version",
PreRun: func(cmd *cobra.Command, args []string) {
PreRun: func(cmd *cobra.Command, _ []string) {
gApp.Config.SetLocalFlagsFromFile(cmd)
},
RunE: gApp.VersionUpgradeRun,
Expand Down
3 changes: 1 addition & 2 deletions cmd/workflow.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd

Expand All @@ -13,7 +12,7 @@ func newWorkflowCmd() *cobra.Command {
Use: "workflow",
Aliases: []string{"wf", "w"},
Short: "run a workflow",
PreRun: func(cmd *cobra.Command, args []string) {
PreRun: func(cmd *cobra.Command, _ []string) {
gApp.Config.SetLocalFlagsFromFile(cmd)
},
PreRunE: gApp.WorkflowPreRunE,
Expand Down
8 changes: 1 addition & 7 deletions config/modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func (o *OperationConfig) CreateAftOper() (*spb.AFTOperation, error) {
api.EncapsulateHeader(o.NH.EncapsulateHeader),
api.DecapsulateHeader(o.NH.DecapsulateHeader),
api.IPAddress(o.NH.IPAddress),
//
api.MAC(o.NH.MAC),
api.NetworkInstance(o.NH.NetworkInstance),
}
Expand All @@ -145,9 +144,6 @@ func (o *OperationConfig) CreateAftOper() (*spb.AFTOperation, error) {
api.IPinIP(o.NH.IPinIP.SRCIP, o.NH.IPinIP.DSTIP),
)
}
if o.NH.ProgrammedIndex != nil {
nheOpts = append(nheOpts, api.ProgrammedIndex(*o.NH.ProgrammedIndex))
}

for _, pmls := range o.NH.PushedMPLSLabelStack {
nheOpts = append(nheOpts,
Expand All @@ -167,9 +163,7 @@ func (o *OperationConfig) CreateAftOper() (*spb.AFTOperation, error) {
if o.NHG.Color != nil {
nhgeOpts = append(nhgeOpts, api.Color(*o.NHG.Color))
}
if o.NHG.ProgrammedID != nil {
nhgeOpts = append(nhgeOpts, api.ProgrammedIndex(*o.NHG.ProgrammedID))
}

for _, nh := range o.NHG.NextHop {
nhgeOpts = append(nhgeOpts, api.NHGNextHop(nh.Index, nh.Weight))
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.5.0
github.com/openconfig/gnmi v0.0.0-20220503232738-6eb133c65a13
github.com/openconfig/gribi v0.1.1-0.20220126144445-1634932f9fd8
github.com/openconfig/gribi v0.1.1-0.20220622162620-08d53dffce45
github.com/openconfig/gribigo v0.0.0-20220216214442-0aae099db56f
github.com/prometheus/client_golang v1.12.2
github.com/sirupsen/logrus v1.8.1
Expand Down
3 changes: 2 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,9 @@ github.com/openconfig/goyang v0.2.9/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+R
github.com/openconfig/goyang v1.0.0 h1:nYaFu7BOAk/eQn4CgAUjgYPfp3J6CdXrBryp32E5CjI=
github.com/openconfig/goyang v1.0.0/go.mod h1:vX61x01Q46AzbZUzG617vWqh/cB+aisc+RrNkXRd3W8=
github.com/openconfig/gribi v0.1.1-0.20210423184541-ce37eb4ba92f/go.mod h1:OoH46A2kV42cIXGyviYmAlGmn6cHjGduyC2+I9d/iVs=
github.com/openconfig/gribi v0.1.1-0.20220126144445-1634932f9fd8 h1:V6QU1cocKPRP1yEfxg0cleaIh95d4yRY572UwKu/W+0=
github.com/openconfig/gribi v0.1.1-0.20220126144445-1634932f9fd8/go.mod h1:VFqGH2ZPFIfnKTimP4/AQB4OK0eySW5muJNFxXAwP6k=
github.com/openconfig/gribi v0.1.1-0.20220622162620-08d53dffce45 h1:pmwzRJYdvc+CQDrIw6NF0XBnTng6SvMYBdZz9CeRbCk=
github.com/openconfig/gribi v0.1.1-0.20220622162620-08d53dffce45/go.mod h1:VFqGH2ZPFIfnKTimP4/AQB4OK0eySW5muJNFxXAwP6k=
github.com/openconfig/gribigo v0.0.0-20220216214442-0aae099db56f h1:W+4+uRld9Tgji/QK/85Ts1ybHWno0LjiGkOyRBNAWUU=
github.com/openconfig/gribigo v0.0.0-20220216214442-0aae099db56f/go.mod h1:udA2WsTVQk9QKDOjNq1UlJ4p5Us8/5HP1bsoYp+ZoKw=
github.com/openconfig/grpctunnel v0.0.0-20210610163803-fde4a9dc048d/go.mod h1:x9tAZ4EwqCQ0jI8D6S8Yhw9Z0ee7/BxWQX0k0Uib5Q8=
Expand Down

0 comments on commit 81e6f22

Please sign in to comment.