Skip to content
Snippets Groups Projects
Commit a1b198fd authored by Malte Bauch's avatar Malte Bauch
Browse files

changed GetDevices to GetDevice

there was no need to get the full device list. but for the cli there is
a need to access specific devices from the pnd via their uuid
parent fdd06d91
Branches
Tags 0.24.0-rc1
3 merge requests!97Resolve "PND handling via CLI and database",!91"Overhaul Architecture",!90Develop
...@@ -17,7 +17,7 @@ type PrincipalNetworkDomain interface { ...@@ -17,7 +17,7 @@ type PrincipalNetworkDomain interface {
RequestAll(string) error RequestAll(string) error
GetName() string GetName() string
GetDescription() string GetDescription() string
GetDevices() map[uuid.UUID]*Device GetDevice(uuid.UUID) (*Device, bool)
GetSBIs() map[string]SouthboundInterface GetSBIs() map[string]SouthboundInterface
} }
...@@ -45,8 +45,8 @@ func (pnd *pndImplementation) GetName() string { ...@@ -45,8 +45,8 @@ func (pnd *pndImplementation) GetName() string {
return pnd.name return pnd.name
} }
func (pnd *pndImplementation) GetDevices() map[uuid.UUID]*Device { func (pnd *pndImplementation) GetDevice(uuid uuid.UUID) (*Device, bool) {
return pnd.devices return pnd.getDevice(uuid)
} }
func (pnd *pndImplementation) GetDescription() string { func (pnd *pndImplementation) GetDescription() string {
...@@ -104,6 +104,11 @@ func (pnd *pndImplementation) removeDevice(uuid uuid.UUID) error { ...@@ -104,6 +104,11 @@ func (pnd *pndImplementation) removeDevice(uuid uuid.UUID) error {
return nil return nil
} }
func (pnd *pndImplementation) getDevice(uuid uuid.UUID) (*Device, bool) {
device, exists := pnd.devices[uuid]
return device, exists
}
func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) error { func (pnd *pndImplementation) Request(uuid uuid.UUID, path string) error {
d := pnd.devices[uuid] d := pnd.devices[uuid]
ctx := context.Background() ctx := context.Background()
......
...@@ -62,6 +62,9 @@ func (oc *OpenConfig) SetNode() func(schema *yang.Entry, root interface{}, path ...@@ -62,6 +62,9 @@ func (oc *OpenConfig) SetNode() func(schema *yang.Entry, root interface{}, path
} }
} }
// deprecated
// Use for prototyping only.
// Use OpenConfig instead
type AristaOC struct { type AristaOC struct {
// deprecated // deprecated
transport Transport transport Transport
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment