monorepoization: move everything into arista-proxy/

master
Serge Bazanski 2018-10-25 12:05:51 +01:00
parent 9cf869b857
commit 8bdee5bcec
8 changed files with 50 additions and 252 deletions

198
Gopkg.lock generated
View File

@ -1,198 +0,0 @@
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
branch = "master"
digest = "1:2af0bc306f77bef606f6f6033652f0de3cc80e77008f4da52197b4b0a6be5853"
name = "code.hackerspace.pl/q3k/hspki"
packages = ["."]
pruneopts = "UT"
revision = "624295da664fea57a1e3bd8cee639ae04f4c0ccf"
[[projects]]
branch = "master"
digest = "1:48353f64f7cc9626e4396b286552812a40a9c1d3e653d51ecbe6cedf2c4f4778"
name = "code.hackerspace.pl/q3k/mirko"
packages = ["."]
pruneopts = "UT"
revision = "b21f9b9a2ec6ada755aac41595acdf1961d3c48d"
[[projects]]
digest = "1:e92f5581902c345eb4ceffdcd4a854fb8f73cf436d47d837d1ec98ef1fe0a214"
name = "github.com/StackExchange/wmi"
packages = ["."]
pruneopts = "UT"
revision = "5d049714c4a64225c3c79a7cf7d02f7fb5b96338"
version = "1.0.0"
[[projects]]
digest = "1:64a5a67c69b70c2420e607a8545d674a23778ed9c3e80607bfd17b77c6c87f6a"
name = "github.com/go-ole/go-ole"
packages = [
".",
"oleutil",
]
pruneopts = "UT"
revision = "a41e3c4b706f6ae8dfbff342b06e40fa4d2d0506"
version = "v1.2.1"
[[projects]]
branch = "master"
digest = "1:1ba1d79f2810270045c328ae5d674321db34e3aae468eb4233883b473c5c0467"
name = "github.com/golang/glog"
packages = ["."]
pruneopts = "UT"
revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998"
[[projects]]
digest = "1:5d1b5a25486fc7d4e133646d834f6fca7ba1cef9903d40e7aa786c41b89e9e91"
name = "github.com/golang/protobuf"
packages = [
"proto",
"protoc-gen-go/descriptor",
"ptypes",
"ptypes/any",
"ptypes/duration",
"ptypes/timestamp",
]
pruneopts = "UT"
revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5"
version = "v1.2.0"
[[projects]]
branch = "master"
digest = "1:a7cc4447e0c2432f217fd2bed937c100ec475272a7a9306477170c2934297357"
name = "github.com/q3k/statusz"
packages = ["."]
pruneopts = "UT"
revision = "924f04ea71149b75f5b10f426cc4c39d6d90f6f2"
[[projects]]
branch = "master"
digest = "1:8f042d4b4c48d38d7a1201096299bd26d044c97c032ab20ee171fe5b0d201d2e"
name = "github.com/shirou/gopsutil"
packages = [
"internal/common",
"load",
]
pruneopts = "UT"
revision = "a11c78ba2c13c5b1ee59c53296ba35f92f0ce658"
[[projects]]
digest = "1:564b31f09a21367ada5b019d8413afe99cf770775606f94c7bef42b2ef79dfdf"
name = "github.com/ybbus/jsonrpc"
packages = ["."]
pruneopts = "UT"
revision = "dd866631e904a5df2067d934985c5def68f391ac"
version = "v2.1.2"
[[projects]]
branch = "master"
digest = "1:505dbee0833715a72a529bb57c354826ad42a4496fad787fa143699b4de1a6d0"
name = "golang.org/x/net"
packages = [
"context",
"http/httpguts",
"http2",
"http2/hpack",
"idna",
"internal/timeseries",
"trace",
]
pruneopts = "UT"
revision = "49bb7cea24b1df9410e1712aa6433dae904ff66a"
[[projects]]
branch = "master"
digest = "1:f5aa274a0377f85735edc7fedfb0811d3cbc20af91633797cb359e29c3272271"
name = "golang.org/x/sys"
packages = [
"unix",
"windows",
]
pruneopts = "UT"
revision = "fa43e7bc11baaae89f3f902b2b4d832b68234844"
[[projects]]
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
name = "golang.org/x/text"
packages = [
"collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable",
]
pruneopts = "UT"
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[[projects]]
branch = "master"
digest = "1:56b0bca90b7e5d1facf5fbdacba23e4e0ce069d25381b8e2f70ef1e7ebfb9c1a"
name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"]
pruneopts = "UT"
revision = "af9cb2a35e7f169ec875002c1829c9b315cddc04"
[[projects]]
digest = "1:dc0c170b110c22d9a4eccf08ab58490608053eac450bf456f3aaf9b30a668781"
name = "google.golang.org/grpc"
packages = [
".",
"balancer",
"balancer/base",
"balancer/roundrobin",
"codes",
"connectivity",
"credentials",
"encoding",
"encoding/proto",
"grpclog",
"internal",
"internal/backoff",
"internal/channelz",
"internal/envconfig",
"internal/grpcrand",
"internal/transport",
"keepalive",
"metadata",
"naming",
"peer",
"reflection",
"reflection/grpc_reflection_v1alpha",
"resolver",
"resolver/dns",
"resolver/passthrough",
"stats",
"status",
"tap",
]
pruneopts = "UT"
revision = "8dea3dc473e90c8179e519d91302d0597c0ca1d1"
version = "v1.15.0"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
input-imports = [
"code.hackerspace.pl/q3k/mirko",
"github.com/golang/glog",
"github.com/golang/protobuf/proto",
"github.com/ybbus/jsonrpc",
"golang.org/x/net/context",
"google.golang.org/grpc",
"google.golang.org/grpc/codes",
"google.golang.org/grpc/status",
]
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,54 +0,0 @@
# Gopkg.toml example
#
# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]]
branch = "master"
name = "code.hackerspace.pl/q3k/mirko"
[[constraint]]
branch = "master"
name = "github.com/golang/glog"
[[constraint]]
name = "github.com/golang/protobuf"
version = "1.2.0"
[[constraint]]
name = "github.com/ybbus/jsonrpc"
version = "2.1.2"
[[constraint]]
branch = "master"
name = "golang.org/x/net"
[[constraint]]
name = "google.golang.org/grpc"
version = "1.15.0"
[prune]
go-tests = true
unused-packages = true

View File

@ -19,6 +19,13 @@ message ShowVersionResponse {
string hardware_revision = 11;
};
message ShowEnvironmentTemperatureRequest {
};
message ShowEnvironmentTemperatureResponse {
};
service AristaProxy {
rpc ShowVersion(ShowVersionRequest) returns (ShowVersionResponse);
rpc ShowEnvironmentTemperature(ShowEnvironmentTemperatureRequest) returns (ShowEnvironmentTemperatureResponse);
};

View File

@ -52,3 +52,46 @@ func (s *server) ShowVersion(ctx context.Context, req *pb.ShowVersionRequest) (*
HardwareRevision: d.HardwareRevision,
}, nil
}
type temperatureSensor struct {
InAlertState bool `json:"inAlertState"`
MaxTemperature float64 `json:"maxTemperature"`
RelPos int64 `json:"relPos"`
Description string `json:"description"`
Name string `json:"name"`
AlertCount int64 `json:"alertCount"`
CurrentTemperature float64 `json:"currentTemperature"`
OverheatThreshold float64 `json:"overheatThreshold"`
CriticalThreshold float64 `json:"criticalThreshold"`
HwStatus string `json:"hwStatus"`
}
func (s *server) ShowEnvironmentTemperature(ctx context.Context, req *pb.ShowEnvironmentTemperatureRequest) (*pb.ShowEnvironmentTemperatureResponse, error) {
var response []struct {
PowerSuppplySlots []struct {
TempSensors []temperatureSensor `json:"tempSensors"`
EntPhysicalClass string `json:"entPhysicalClass"`
RelPos int64 `json:"relPos"`
} `json:"powerSupplySlots"`
ShutdownOnOverheat bool `json:"shutdownOnOverheat"`
TempSensors []temperatureSensor `json:"tempSensors"`
SystemStatus string `json:"systemStatus"`
}
err := s.arista.structuredCall(&response, "show environment temperature")
if err != nil {
glog.Errorf("EOS Capi: show environment temperature: %v", err)
return nil, status.Error(codes.Unavailable, "EOS Capi call failed")
}
if len(response) != 1 {
glog.Errorf("Expected 1-length result, got %d", len(response))
return nil, status.Error(codes.Internal, "Internal error")
}
d := response[0]
glog.Infof("%+v", d)
return &pb.ShowEnvironmentTemperatureResponse{}, nil
}