Skip to content
Snippets Groups Projects
device.go 864 B
Newer Older
  • Learn to ignore specific revisions
  • Manuel Kieweg's avatar
    Manuel Kieweg committed
    package nucleus
    
    import (
    	"github.com/google/uuid"
    	"github.com/openconfig/ygot/ygot"
    )
    
    type Device struct {
    
    	// Device inherits properties of ygot.GoStruct
    
    	ygot.GoStruct
    
    	// SBI is the device's southbound interface implementation
    
    	SBI SouthboundInterface `json:"-"`
    
    
    	// Config is the device's config. Under revision
    
    	Config DeviceConfig `json:"-"`
    
    
    	// Transport is the device's Transport implementation
    
    	Transport Transport `json:"-"`
    
    func NewDevice(sbi SouthboundInterface, addr, username, password string,
    	transport Transport) *Device {
    	return &Device{
    		GoStruct: sbi.Schema().Root,
    		SBI:      sbi,
    		Config: DeviceConfig{
    			Uuid:     uuid.New(),
    			Address:  addr,
    			Username: username,
    			Password: password,
    		},
    		Transport: transport,
    	}
    }
    
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    type DeviceConfig struct {
    
    Manuel Kieweg's avatar
    Manuel Kieweg committed
    	Uuid     uuid.UUID
    	Address  string
    	Username string
    	Password string