This commit is contained in:
asteam
2024-12-04 13:18:58 +03:00
parent 003e4d656e
commit 76ea459b3d
417 changed files with 30051 additions and 975 deletions

View File

@@ -189,24 +189,27 @@ func flattenInterfaces(ctx context.Context, items *vins.ListVNFInterfaces) types
tempSlice := make([]types.Object, 0, len(*items))
for _, item := range *items {
temp := models.VNFInterfaceModel{
ConnID: types.Int64Value(int64(item.ConnID)),
ConnType: types.StringValue(item.ConnType),
DefGW: types.StringValue(item.DefGW),
Enabled: types.BoolValue(item.Enabled),
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
GUID: types.StringValue(item.GUID),
IPAddress: types.StringValue(item.IPAddress),
ListenSSH: types.BoolValue(item.ListenSSH),
MAC: types.StringValue(item.MAC),
Name: types.StringValue(item.Name),
NetID: types.Int64Value(int64(item.NetID)),
NetMask: types.Int64Value(int64(item.NetMask)),
NetType: types.StringValue(item.NetType),
NodeID: types.Int64Value(int64(item.NodeID)),
PCISlot: types.Int64Value(int64(item.PCISlot)),
QOS: flattenQOS(ctx, &item.QOS),
Target: types.StringValue(item.Target),
Type: types.StringValue(item.Type),
BusNumber: types.Int64Value(int64(item.BusNumber)),
ConnID: types.Int64Value(int64(item.ConnID)),
ConnType: types.StringValue(item.ConnType),
DefGW: types.StringValue(item.DefGW),
Enabled: types.BoolValue(item.Enabled),
FLIPGroupID: types.Int64Value(int64(item.FLIPGroupID)),
GUID: types.StringValue(item.GUID),
IPAddress: types.StringValue(item.IPAddress),
ListenSSH: types.BoolValue(item.ListenSSH),
MAC: types.StringValue(item.MAC),
MTU: types.Int64Value(int64(item.MTU)),
Libvirtsettings: flattenLibvirtSettings(ctx, &item.LibvirtSettings),
Name: types.StringValue(item.Name),
NetID: types.Int64Value(int64(item.NetID)),
NetMask: types.Int64Value(int64(item.NetMask)),
NetType: types.StringValue(item.NetType),
NodeID: types.Int64Value(int64(item.NodeID)),
PCISlot: types.Int64Value(int64(item.PCISlot)),
QOS: flattenQOS(ctx, &item.QOS),
Target: types.StringValue(item.Target),
Type: types.StringValue(item.Type),
}
temp.VNFs, diags = types.ListValueFrom(ctx, types.Int64Type, item.VNFs)
@@ -230,6 +233,28 @@ func flattenInterfaces(ctx context.Context, items *vins.ListVNFInterfaces) types
return res
}
func flattenLibvirtSettings(ctx context.Context, settings *vins.LibvirtSettings) types.Object {
tflog.Info(ctx, "Start flattenLibvirtSettings")
temp := models.LibvirtSettingsModel{
TXMode: types.StringValue(settings.TXMode),
IOEventFD: types.StringValue(settings.IOEventFD),
EventIDx: types.StringValue(settings.EventIDx),
Queues: types.Int64Value(int64(settings.Queues)),
RXQueueSize: types.Int64Value(int64(settings.RXQueueSize)),
TXQueueSize: types.Int64Value(int64(settings.TXQueueSize)),
GUID: types.StringValue(settings.GUID),
}
res, err := types.ObjectValueFrom(ctx, models.LibvirtSettings, temp)
if err != nil {
tflog.Error(ctx, fmt.Sprint("Error flattenLibvirtSettings struct to obj", err))
}
tflog.Info(ctx, "End flattenLibvirtSettings")
return res
}
// flattenQOS flattens QOS.
// Flatten errors are added to tflog.
func flattenQOS(ctx context.Context, qos *vins.QOS) types.Object {