Skip to content
Snippets Groups Projects
device.go 2.14 KiB
Newer Older
  • Learn to ignore specific revisions
  • package device
    
    import (
    
    	"code.fbi.h-da.de/danet/gosdn/controller/interfaces/southbound"
    	"code.fbi.h-da.de/danet/gosdn/controller/interfaces/transport"
    
    	"github.com/google/uuid"
    	"github.com/openconfig/ygot/ygot"
    	"google.golang.org/protobuf/proto"
    
    
    	tpb "code.fbi.h-da.de/danet/gosdn/api/go/gosdn/transport"
    
    )
    
    // Device represents an Orchestrated Network Device (OND) which is managed by
    // nucleus
    type Device interface {
    	ID() uuid.UUID
    
    	GetModel() ygot.GoStruct
    
    	Transport() transport.Transport
    	Name() string
    	SBI() southbound.SouthboundInterface
    	ProcessResponse(proto.Message) error
    
    	IsTransportValid() bool
    
    
    // Details contains details of a device used by the cSBI mechanism
    type Details struct {
    	ID              string
    	Address         string
    	TransportOption *tpb.TransportOption
    }
    
    
    // LoadedDevice represents a Orchestrated Networking Device that was loaeded
    // by using the Load() method of the DeviceStore.
    type LoadedDevice struct {
    
    	// ID represents the UUID of the LoadedDevice.
    	ID string `json:"id" bson:"_id"`
    
    	// Name represents the name of the LoadedDevice.
    	Name string `json:"name,omitempty"`
    	// TransportType represent the type of the transport in use of the LoadedDevice.
    	TransportType string `json:"transport_type,omitempty" bson:"transport_type,omitempty"`
    	// TransportAddress represents the address from which the device can be reached via the transport method.
    	TransportAddress string `json:"transport_address,omitempty" bson:"transport_address,omitempty"`
    	// TransportUsername is used for authentication via the transport method in use.
    	TransportUsername string `json:"transport_username,omitempty" bson:"transport_username,omitempty"`
    	// TransportPassword is used for authentication via the transport method in use.
    	TransportPassword   string `json:"transport_password,omitempty" bson:"transport_password,omitempty"`
    	TransportOptionCsbi bool   `json:"transport_option_csbi,omitempty" bson:"transport_option_csbi,omitempty"`
    
    	// SBI indicates the southbound interface, which is used by this device as UUID.
    	SBI   string `json:"sbi"`
    	Model string `json:"model,omitempty" bson:"model,omitempty"`
    }