seba-260 get inventory
Change-Id: Icd3f955d55ed71ab18cbab6f669ce244ab7c47da
diff --git a/api/abstract_olt_api.proto b/api/abstract_olt_api.proto
index 7a8cb69..6c5304b 100644
--- a/api/abstract_olt_api.proto
+++ b/api/abstract_olt_api.proto
@@ -104,7 +104,6 @@
bool Success=1;
}
message ReflowMessage{
-
}
message ReflowReturn{
bool Success=1;
@@ -115,6 +114,14 @@
message OutputReturn{
bool Success=1;
}
+message FullInventoryMessage{
+}
+message InventoryMessage{
+ string Clli=1;
+}
+message InventoryReturn{
+ string JsonDump=1;
+}
service AbstractOLT{
rpc Echo(EchoMessage) returns (EchoReplyMessage){
option(google.api.http)={
@@ -171,5 +178,17 @@
body:"*"
};
}
+ rpc GetFullInventory(FullInventoryMessage)returns(InventoryReturn){
+ option(google.api.http)={
+ post:"/v1/FullInventory"
+ body:"*"
+ };
+ }
+ rpc GetInventory(InventoryMessage)returns(InventoryReturn){
+ option(google.api.http)={
+ post:"/v1/Inventory"
+ body:"*"
+ };
+ }
}
diff --git a/api/handler.go b/api/handler.go
index ee70d74..f2e832e 100644
--- a/api/handler.go
+++ b/api/handler.go
@@ -23,6 +23,7 @@
"sync"
"gerrit.opencord.org/abstract-olt/internal/pkg/impl"
+ "gerrit.opencord.org/abstract-olt/models/inventory"
context "golang.org/x/net/context"
)
@@ -130,7 +131,7 @@
}
/*
-ProvsionOntFull - provisions ont using sTag,cTag,NasPortID, and CircuitID passed in
+ProvisionOntFull - provisions ont using sTag,cTag,NasPortID, and CircuitID passed in
*/
func (s *Server) ProvisionOntFull(ctx context.Context, in *AddOntFullMessage) (*AddOntReturn, error) {
clli := in.GetCLLI()
@@ -159,13 +160,36 @@
return &DeleteOntReturn{Success: success}, err
}
+/*
+Reflow - iterates through provisioning to rebuild Seba-Pod
+*/
func (s *Server) Reflow(ctx context.Context, in *ReflowMessage) (*ReflowReturn, error) {
success, err := impl.Reflow()
return &ReflowReturn{Success: success}, err
}
+
+/*
+Output - causes an immediate backup to be created
+*/
func (s *Server) Output(ctx context.Context, in *OutputMessage) (*OutputReturn, error) {
success, err := impl.DoOutput()
return &OutputReturn{Success: success}, err
}
+
+/*
+GetFullInventory - gets a full json dump of the currently provisioned equipment
+*/
+func (s *Server) GetFullInventory(ctx context.Context, in *FullInventoryMessage) (*InventoryReturn, error) {
+ json := inventory.GatherAllInventory()
+ return &InventoryReturn{JsonDump: json}, nil
+}
+
+/*
+GetInventory - returns a json dump of a particular seba-pod
+*/
+func (s *Server) GetInventory(ctx context.Context, in *InventoryMessage) (*InventoryReturn, error) {
+ json := inventory.GatherInventory(in.GetClli())
+ return &InventoryReturn{JsonDump: json}, nil
+}