Newer
Older
// PrincipalNetworkDomain provides an
// interface for PND implementations
type PrincipalNetworkDomain interface {
GetDescription() string
GetDefaultSBIName() string
AddSbi(SouthboundInterface) error
RemoveSbi(string) error
AddDevice(Device) error
RemoveDevice(uuid uuid.UUID) error
}
Name string
Description string
Sbi map[string]SouthboundInterface
Devices map[uuid.UUID]Device
func NewPND(name, description string, sbi SouthboundInterface) PrincipalNetworkDomain {
Name: name,
Description: description,
Sbi: sbic,
Devices: devices,
func (pnd *pndImplementation) GetName() string {
return pnd.Name
}
func (pnd *pndImplementation) GetDescription() string {
return pnd.Description
}
func (pnd *pndImplementation) GetDefaultSBIName() string {
return pnd.Sbi["default"].SbiIdentifier()
}
// Interface satisfaction
func (pnd *pndImplementation) Destroy() error {
return destroy()
}
func (pnd *pndImplementation) AddSbi(sbi SouthboundInterface) error {
return pnd.addSbi(sbi)
func (pnd *pndImplementation) RemoveSbi(sbiIdentifier string) error {
return pnd.removeSbi(sbiIdentifier)
func (pnd *pndImplementation) AddDevice(device Device) error {
}
func (pnd *pndImplementation) RemoveDevice(uuid uuid.UUID) error {
// Actual implementation, bind to struct if
// neccessary
func destroy() error {
return nil
}
func (pnd *pndImplementation) addSbi(sbi SouthboundInterface) error {
pnd.Sbi[sbi.SbiIdentifier()] = sbi
func (pnd *pndImplementation) removeSbi(sbiIdentifier string) error {
delete(pnd.Sbi, sbiIdentifier)
func (pnd *pndImplementation) addDevice(device Device) error {
pnd.Devices[device.Uuid] = device
func (pnd *pndImplementation) removeDevice(uuid uuid.UUID) error {