Skip to content
Snippets Groups Projects

Improve usability and better output formatting for gosndc

Merged Malte Bauch requested to merge cli-refactoring-pterm into develop
5 files
+ 23
18
Compare changes
  • Side-by-side
  • Inline
Files
5
+ 9
13
@@ -11,7 +11,6 @@ import (
"code.fbi.h-da.de/danet/gosdn/controller/nucleus/errors"
"github.com/google/uuid"
"github.com/openconfig/goyang/pkg/yang"
log "github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"
"google.golang.org/protobuf/proto"
)
@@ -106,17 +105,16 @@ func (p *PndAdapter) RemovePnd(pid uuid.UUID) (*core.DeletePndResponse, error) {
// ChangeOND sends an API call to the controller requesting the creation of
// a change from the provided Operation, path and value. The Change is marked
// as Pending and times out after the specified timeout period
func (p *PndAdapter) ChangeOND(duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error) {
func (p *PndAdapter) ChangeOND(duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (*ppb.SetPathListResponse, error) {
var v string
if len(value) != 0 {
v = value[0]
}
resp, err := api.ChangeRequest(p.endpoint, duid.String(), p.id.String(), path, v, operation)
if err != nil {
return uuid.Nil, err
return nil, err
}
log.Info(resp)
return uuid.Nil, err
return resp, err
}
// Request sends an API call to the controller requesting the specified path
@@ -221,23 +219,21 @@ func (p *PndAdapter) GetChange(uuid.UUID) (change.Change, error) {
}
// Commit sends an API call to the controller committing the specified change
func (p *PndAdapter) Commit(cuid uuid.UUID) error {
func (p *PndAdapter) Commit(cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Commit(p.endpoint, p.id.String(), cuid.String())
if err != nil {
return err
return nil, err
}
log.Info(resp)
return nil
return resp, nil
}
// Confirm sends an API call to the controller confirming the specified change
func (p *PndAdapter) Confirm(cuid uuid.UUID) error {
func (p *PndAdapter) Confirm(cuid uuid.UUID) (*ppb.SetChangeListResponse, error) {
resp, err := api.Confirm(p.endpoint, p.id.String(), cuid.String())
if err != nil {
return err
return nil, err
}
log.Info(resp)
return nil
return resp, nil
}
func filterChanges(state ppb.ChangeState, resp *ppb.GetChangeListResponse) []uuid.UUID {
Loading