BW profile response fix
Change-Id: I507f23b87b0a7e988a3e6550b408d9092e3f08c4
diff --git a/internal/pkg/vpagent/changeEvent.go b/internal/pkg/vpagent/changeEvent.go
index 3e536b9..d63abe7 100644
--- a/internal/pkg/vpagent/changeEvent.go
+++ b/internal/pkg/vpagent/changeEvent.go
@@ -61,7 +61,6 @@
default:
ce, err := stream.Recv()
if err == io.EOF {
- logger.Warnw(ctx, "EOF for receiveChangeEvents stream, reconnecting", log.Fields{"err": err})
stream, err = vServiceClient.ReceiveChangeEvents(streamCtx, &empty.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive Change Event Stream",
diff --git a/internal/pkg/vpagent/packetIn.go b/internal/pkg/vpagent/packetIn.go
index a0209f2..aadf19f 100644
--- a/internal/pkg/vpagent/packetIn.go
+++ b/internal/pkg/vpagent/packetIn.go
@@ -56,7 +56,6 @@
default:
pkt, err := stream.Recv()
if err == io.EOF {
- logger.Infow(ctx, "EOF for receivePacketsIn stream, reconnecting", log.Fields{"err": err})
stream, err = vpa.volthaClient.Get().ReceivePacketsIn(streamCtx, &empty.Empty{}, opt)
if err != nil {
logger.Errorw(ctx, "Unable to establish Receive PacketIn Stream",
diff --git a/voltha-go-controller/nbi/bwprofile.go b/voltha-go-controller/nbi/bwprofile.go
index ee2075d..3e13453 100644
--- a/voltha-go-controller/nbi/bwprofile.go
+++ b/voltha-go-controller/nbi/bwprofile.go
@@ -33,21 +33,17 @@
cDelete = "DELETE"
)
-type BWEntry struct {
- Entries []BWProfile `json:"entry"`
-}
-
-// BWProfile - Sadis BW Profile
+//BWProfile - Sadis BW Profile
type BWProfile struct {
- ID string `json:"id"`
- PeakInformationRate uint32 `json:"pir"`
- PeakBurstSize uint32 `json:"pbs"`
- CommittedInformationRate uint32 `json:"cir"`
- CommittedBurstSize uint32 `json:"cbs"`
- ExceededInformationRate uint32 `json:"eir"`
- ExceededBurstSize uint32 `json:"ebs"`
- AssuredInformationRate uint32 `json:"air"`
- GuaranteedInformationRate uint32 `json:"gir"`
+ ID string `json:"id,omitempty"`
+ PeakInformationRate uint32 `json:"pir,omitempty"`
+ PeakBurstSize uint32 `json:"pbs,omitempty"`
+ CommittedInformationRate uint32 `json:"cir,omitempty"`
+ CommittedBurstSize uint32 `json:"cbs,omitempty"`
+ ExceededInformationRate uint32 `json:"eir,omitempty"`
+ ExceededBurstSize uint32 `json:"ebs,omitempty"`
+ AssuredInformationRate uint32 `json:"air,omitempty"`
+ GuaranteedInformationRate uint32 `json:"gir,omitempty"`
}
// ProfileDelReq structure
@@ -113,9 +109,6 @@
vars := mux.Vars(r)
profileName := vars["id"]
- var bwEntryResp BWEntry
- bwEntryResp.Entries = []BWProfile{}
-
cfg, ok := app.GetApplication().GetMeterByName(profileName)
if !ok {
logger.Warnw(ctx, "Meter profile does not exist", log.Fields{"Name": profileName})
@@ -133,8 +126,7 @@
ExceededInformationRate: cfg.Eir,
ExceededBurstSize: cfg.Ebs,
}
- bwEntryResp.Entries = append(bwEntryResp.Entries, profileResp)
- profileRespJSON, err := json.Marshal(bwEntryResp)
+ profileRespJSON, err := json.Marshal(profileResp)
if err != nil {
logger.Errorw(ctx, "Failed to marshal profile response", log.Fields{"Error": err})
w.WriteHeader(http.StatusInternalServerError)