Skip to content

Commit

Permalink
fix: fixing hardcoded device status for dnac device
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ko committed Mar 11, 2024
1 parent 208682d commit 63ee1e0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/source/dnac/dnac_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ func (ds *DnacSource) SyncDevices(nbi *inventory.NetboxInventory) error {
return fmt.Errorf("hostTenant: %s", err)
}

deviceStatus := &objects.DeviceStatusActive
if device.ReachabilityStatus == "Unreachable" {
deviceStatus = &objects.DeviceStatusOffline
}

nbDevice, err := nbi.AddDevice(ds.Ctx, &objects.Device{
NetboxObject: objects.NetboxObject{
Tags: ds.Config.SourceTags,
Expand All @@ -175,6 +180,7 @@ func (ds *DnacSource) SyncDevices(nbi *inventory.NetboxInventory) error {
},
},
Name: device.Hostname,
Status: deviceStatus,
Tenant: deviceTenant,
DeviceRole: deviceRole,
SerialNumber: device.SerialNumber,
Expand Down

0 comments on commit 63ee1e0

Please sign in to comment.