Skip to content
Snippets Groups Projects
additions.go 1.87 KiB
Newer Older
  • Learn to ignore specific revisions
  • Shrey Garg's avatar
    Shrey Garg committed
    package additions
    
    import (
    	"net"
    
    
    	gnmitargetygot "code.fbi.h-da.de/danet/gnmi-target/examples/example01/model"
    
    Shrey Garg's avatar
    Shrey Garg committed
    )
    
    type interfaces struct{}
    type networkInstances struct{}
    
    func NewInterfaces() Interfaces {
    	return &interfaces{}
    }
    
    func NewNetworkInstances() NetworkInstances {
    	return &networkInstances{}
    }
    
    
    // NOTE: these extra structs are probably not necessary and it would be smarter
    // to just use the ygot generated structs internally aswell. This would prevent
    // passing information through multiple structs.
    
    Shrey Garg's avatar
    Shrey Garg committed
    type Interface struct {
    	Index         *uint32
    	Name          *string
    	Type          gnmitargetygot.E_IETFInterfaces_InterfaceType
    	MTU           *uint16
    	OperState     gnmitargetygot.E_OpenconfigInterfaces_Interfaces_Interface_State_OperStatus
    	AdminStatus   gnmitargetygot.E_OpenconfigInterfaces_Interfaces_Interface_State_AdminStatus
    	LoopbackMode  *bool
    	Ipv4Addresses []IPAddress
    	Ipv6Addresses []IPAddress
    }
    
    // IPAddress represents a IPv4 or Ipv6 address in the context of a
    // osclient.
    // NOTE: (maba) will probably be extended
    type IPAddress struct {
    	//TODO: add more
    	net.IPNet
    	Broadcast net.IP
    }
    
    type StaticRoute struct {
    	//TODO: add more
    	Prefix *string
    	Hops   []Hop
    
    	RouteType string
    
    Shrey Garg's avatar
    Shrey Garg committed
    }
    
    type Hop struct {
    	//TODO: add more
    	InterfaceRef *string
    	Index        *string
    	NextHop      gnmitargetygot.OpenconfigNetworkInstance_NetworkInstances_NetworkInstance_Protocols_Protocol_StaticRoutes_Static_NextHops_NextHop_Config_NextHop_Union
    }
    
    
    type Modem struct {
    	Name           *string
    	Time           *string
    	Timezone       *string
    	State          *string
    	SignalQuality  *uint32
    	Sim            Sim
    	Firmwares      []Firmware
    	Ports          []Port
    	SupportedBands []string
    	CurrentBands   []string
    }
    
    type Firmware struct {
    	ID       *string
    	Selected *bool
    }
    
    type Port struct {
    	Name *string
    	Type *string
    }
    
    type Sim struct {
    	Identifier   *string
    	OperatorName *string
    }