Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
FolderOrigin-RevId: /usr/local/google/home/bstoll/copybara/temp/folder-destination8123793308587236561/.
  • Loading branch information
GGN Engprod Team authored and bstoll committed Sep 17, 2024
1 parent c5b17ab commit fc41e32
Show file tree
Hide file tree
Showing 72 changed files with 66,746 additions and 51,643 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:

- name: Install protoc-gen-go and grpc
run: |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
Expand Down
6 changes: 6 additions & 0 deletions binding/abstract.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ func (*AbstractGNSIClients) Acctz() acctzpb.AcctzClient {
return nil
}

// AcctzStream logs a fatal unimplemented error.
func (*AbstractGNSIClients) AcctzStream() acctzpb.AcctzStreamClient {
log.Fatal("AcctzStream unimplemented")
return nil
}

// Attestz logs a fatal unimplemented error.
func (*AbstractGNSIClients) Attestz() attestzpb.TpmAttestzServiceClient {
log.Fatal("Attestz unimplemented")
Expand Down
1 change: 1 addition & 0 deletions binding/binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ type GNSIClients interface {
Certz() certzpb.CertzClient
Credentialz() credzpb.CredentialzClient
Acctz() acctzpb.AcctzClient
AcctzStream() acctzpb.AcctzStreamClient
Attestz() attestzpb.TpmAttestzServiceClient
Enrollz() enrollzpb.TpmEnrollzServiceClient
mustEmbedAbstractGNSIClients()
Expand Down
8 changes: 4 additions & 4 deletions binding/grpcutil/testservice/gen/testservice.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 52 additions & 58 deletions binding/grpcutil/testservice/gen/testservice_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions binding/introspect/introspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Service string
const (
GNMI Service = "gNMI"
GNOI Service = "gNOI"
GNPSI Service = "gNPSI"
GNSI Service = "gNSI"
GRIBI Service = "gRIBI"
OTG Service = "OTG"
Expand Down
5 changes: 4 additions & 1 deletion binding/portgraph/portgraph.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ func (pa *portAssigner) assign(ctx context.Context) bool {
select {
case <-ctx.Done():
// The context is done. Stop work.
log.Warningf("Timeout occurred before solve was finished, error: %v", ctx.Err())
log.WarningContextf(ctx, "Timeout occurred before solve was finished, error: %v", ctx.Err())
return false
default:
}
Expand Down Expand Up @@ -694,6 +694,9 @@ func (s *solver) processConstraints() {
nc.Set(k, reAny)
case LeafConstraint:
nc.Set(k, v)
case nil:
// The constraint is nil; this usually should not happen and indicates an input error.
log.Warningf("Node %q has a nil constraint", n.Desc)
default:
log.Fatalf("Unrecognized constraint type %T for node matching", v)
}
Expand Down
4 changes: 2 additions & 2 deletions binding/portgraph/portgraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ var superGraph = &ConcreteGraph{

// Setup abstract Nodes and Ports for testing.
var (
// One Node
abs1 = &AbstractNode{Desc: "abs1", Constraints: map[string]NodeConstraint{"attr": Equal("")}}
// One Node with one valid constraint and one nil constraint (which should be ignored).
abs1 = &AbstractNode{Desc: "abs1", Constraints: map[string]NodeConstraint{"attr": Equal(""), "nil": nil}}

// One Node, one Port
abs2 = &AbstractNode{Desc: "abs2", Ports: []*AbstractPort{abs2port1}, Constraints: map[string]NodeConstraint{"vendor": Equal("UNIQUE9")}}
Expand Down
39 changes: 39 additions & 0 deletions binding/portgraph/solve_err.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,51 @@ import (
"strings"
)

// solveReport generates a report with all the events that happened during a solve.
type solveReport struct {
report []string
}

func (s *solveReport) String() string {
report := &strings.Builder{}
fmt.Fprintln(report, "Solve report:")
for _, r := range s.report {
fmt.Fprintln(report, r)
}
return report.String()
}

func (s *solveReport) TryAssign(device string, node string) {
s.report = append(s.report, fmt.Sprintf("[TRY_ASSIGN]: Trying to assign %s to %s", device, node))
}

func (s *solveReport) Assigned(device string, node string, constraints map[string]string) {
desc := &strings.Builder{}
fmt.Fprintf(desc, "[ASSIGNED]: Assigned %s to %s", device, node)
if len(constraints) > 0 {
fmt.Fprintf(desc, " with constraints")
for k, v := range constraints {
fmt.Fprintf(desc, " %s: %s", k, v)
}
}
s.report = append(s.report, desc.String())
}

func (s *solveReport) Unassigned(device string, node string) {
s.report = append(s.report, fmt.Sprintf("[UNASSIGNED]: Unassigned %s from %s", device, node))
}

func (s *solveReport) ConstraintFailed(device string, node string, constraint string, got string, want string) {
s.report = append(s.report, fmt.Sprintf("[CONSTRAINT_FAIL]: %s does not match required constraint %s for %s got: %s want: %s", device, constraint, node, got, want))
}

// solveError implements error and contains information about a call to Solve.
type solveError struct {
absGraphDesc string
conGraphDesc string
wrappedErr error
maxAssign *Assignment
report *solveReport
}

func (s *solveError) Unwrap() error {
Expand Down
4 changes: 4 additions & 0 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const (
NOKIA = Vendor(opb.Device_NOKIA)
// ARUBA vendor.
ARUBA = Vendor(opb.Device_ARUBA)
// ALPINE vendor.
ALPINE = Vendor(opb.Device_ALPINE)
)

// String returns the name of the vendor.
Expand Down Expand Up @@ -174,6 +176,8 @@ const (
Speed5Gb = Speed(opb.Port_S_5GB)
// Speed10Gb is a port speed of 10Gbps.
Speed10Gb = Speed(opb.Port_S_10GB)
// Speed25Gb is a port speed of 25Gbps.
Speed25Gb = Speed(opb.Port_S_25GB)
// Speed40Gb is a port speed of 40Gbps.
Speed40Gb = Speed(opb.Port_S_40GB)
// Speed100Gb is a port speed of 100Gbps.
Expand Down
1 change: 1 addition & 0 deletions gnmi/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ YANG_FILES=(
public/release/models/qos/openconfig-qos-interfaces.yang
public/release/models/qos/openconfig-qos-types.yang
public/release/models/qos/openconfig-qos.yang
public/release/models/relay-agent/openconfig-relay-agent.yang
public/release/models/rib/openconfig-rib-bgp.yang
public/release/models/sampling/openconfig-sampling-sflow.yang
public/release/models/segment-routing/openconfig-segment-routing-types.yang
Expand Down
1 change: 1 addition & 0 deletions gnmi/oc/acl/acl-0.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ using the following YANG input files:
- public/release/models/qos/openconfig-qos-interfaces.yang
- public/release/models/qos/openconfig-qos-types.yang
- public/release/models/qos/openconfig-qos.yang
- public/release/models/relay-agent/openconfig-relay-agent.yang
- public/release/models/rib/openconfig-rib-bgp.yang
- public/release/models/sampling/openconfig-sampling-sflow.yang
- public/release/models/segment-routing/openconfig-segment-routing-types.yang
Expand Down
1 change: 1 addition & 0 deletions gnmi/oc/ateflow/ateflow-0.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ using the following YANG input files:
- public/release/models/qos/openconfig-qos-interfaces.yang
- public/release/models/qos/openconfig-qos-types.yang
- public/release/models/qos/openconfig-qos.yang
- public/release/models/relay-agent/openconfig-relay-agent.yang
- public/release/models/rib/openconfig-rib-bgp.yang
- public/release/models/sampling/openconfig-sampling-sflow.yang
- public/release/models/segment-routing/openconfig-segment-routing-types.yang
Expand Down
1 change: 1 addition & 0 deletions gnmi/oc/definedsets/definedsets-0.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ using the following YANG input files:
- public/release/models/qos/openconfig-qos-interfaces.yang
- public/release/models/qos/openconfig-qos-types.yang
- public/release/models/qos/openconfig-qos.yang
- public/release/models/relay-agent/openconfig-relay-agent.yang
- public/release/models/rib/openconfig-rib-bgp.yang
- public/release/models/sampling/openconfig-sampling-sflow.yang
- public/release/models/segment-routing/openconfig-segment-routing-types.yang
Expand Down
Loading

0 comments on commit fc41e32

Please sign in to comment.