Skip to content

Commit

Permalink
Merge pull request #857 from Juniper/bug/856-handle-custom-device-pro…
Browse files Browse the repository at this point in the history
…file

Read Device Profile from Managed Device User Data if populated
  • Loading branch information
chrismarget-j authored Sep 16, 2024
2 parents d47d714 + 8599aba commit 4e73645
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apstra/blueprint/device_allocation.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,13 @@ func (o *DeviceAllocation) deviceProfileNodeIdFromSystemIdAndDeviceKey(ctx conte
return
}

var deviceProfileId string
if si.UserConfig.AosHclModel != "" {
deviceProfileId = si.UserConfig.AosHclModel.String()
} else {
deviceProfileId = si.Facts.AosHclModel.String()
}

query := new(apstra.PathQuery).
SetClient(client).
SetBlueprintId(apstra.ObjectId(o.BlueprintId.ValueString())).
Expand All @@ -622,7 +629,7 @@ func (o *DeviceAllocation) deviceProfileNodeIdFromSystemIdAndDeviceKey(ctx conte
Out([]apstra.QEEAttribute{apstra.RelationshipTypeDeviceProfile.QEEAttribute()}).
Node([]apstra.QEEAttribute{
apstra.NodeTypeDeviceProfile.QEEAttribute(),
{Key: "device_profile_id", Value: apstra.QEStringVal(si.Facts.AosHclModel.String())},
{Key: "device_profile_id", Value: apstra.QEStringVal(deviceProfileId)},
{Key: "name", Value: apstra.QEStringVal("n_device_profile")},
})

Expand Down

0 comments on commit 4e73645

Please sign in to comment.