Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion internal/provider/cisco/iosxr/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ func (p *Provider) ListPorts(ctx context.Context) ([]provider.DevicePort, error)

func (p *Provider) GetDeviceInfo(ctx context.Context) (*provider.DeviceInfo, error) {
i := new(BasicDeviceInfo)
hostName := new(Hostname)

if err := p.client.GetConfig(ctx, hostName); err != nil {
return nil, err
}

if err := p.client.GetState(ctx, i); err != nil {
return nil, err
Expand All @@ -90,7 +95,7 @@ func (p *Provider) GetDeviceInfo(ctx context.Context) (*provider.DeviceInfo, err
Model: i.Model,
SerialNumber: i.SerialNumber,
FirmwareVersion: i.FirmwareVersion,
Hostname: i.Hostname,
Hostname: string(*hostName),
}, nil
}

Expand Down
10 changes: 7 additions & 3 deletions internal/provider/cisco/iosxr/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ import "time"

const Manufacturer = "Cisco"

// Hostname is the hostname of the device, e.g. "router1".
type Hostname string

func (*Hostname) XPath() string {
return "Cisco-IOS-XR-shellutil-cfg:host-names/host-name"
}

type BasicDeviceInfo struct {
// Model is the chassis model of the device, e.g. "NCS-57C3-MOD-SYS".
Model string `json:"model-name"`
Expand All @@ -16,9 +23,6 @@ type BasicDeviceInfo struct {

// FirmwareVersion is the firmware version of the device, e.g. "25.2.2".
FirmwareVersion string `json:"firmware-version"`

// Hostname is the hostname of the device, e.g. "router1".
Hostname string `json:"name"`
}

func (*BasicDeviceInfo) XPath() string {
Expand Down
Loading