Skip to content
Snippets Groups Projects

WIP: Develop

Merged Ghost User requested to merge develop into master
1 file
+ 17
5
Compare changes
  • Side-by-side
  • Inline
@@ -39,6 +39,10 @@ import (
"github.com/spf13/viper"
)
// NOTE: Until we've added database support for changes, we will hold
// changeStores in memory for now.
var changeStoreMap = make(map[uuid.UUID]*store.ChangeStore)
// NewPND creates a Principle Network Domain
func NewPND(
name string,
@@ -49,12 +53,18 @@ func NewPND(
) (networkdomain.NetworkDomain, error) {
sbiStore := NewSbiStore(id)
changeStore, ok := changeStoreMap[id]
if !ok {
changeStore = store.NewChangeStore()
changeStoreMap[id] = changeStore
}
pnd := &pndImplementation{
Name: name,
Description: description,
sbic: sbiStore,
devices: NewDeviceStore(id, sbiStore),
changes: store.NewChangeStore(),
changes: changeStore,
Id: id,
csbiClient: c,
@@ -399,10 +409,12 @@ func (pnd *pndImplementation) RequestAll(path string) error {
// ChangeOND creates a change from the provided Operation, path and value.
// The Change is Pending and times out after the specified timeout period
func (pnd *pndImplementation) ChangeOND(duid uuid.UUID, operation ppb.ApiOperation, path string, value ...string) (uuid.UUID, error) {
d, err := pnd.devices.Get((store.Query{
ID: duid,
Name: "",
}))
d, err := pnd.devices.Get(store.Query{
ID: duid,
})
if err != nil {
return uuid.Nil, err
}
cpy, err := ygot.DeepCopy(d.GetModel())
ygot.BuildEmptyTree(cpy)
if err != nil {
Loading