4.7.0
This commit is contained in:
@@ -72,6 +72,7 @@ func flattenVins(d *schema.ResourceData, vinsRecord *vins.RecordVINS) {
|
||||
d.Set("vnfs", flattenVinsRecordVNFs(vinsRecord.VNFs))
|
||||
d.Set("vxlan_id", vinsRecord.VXLANID)
|
||||
d.Set("nat_rule", flattenRuleBlock(vinsRecord.VNFs.NAT.Config.Rules))
|
||||
d.Set("computes", flattenComputes(vinsRecord.Computes))
|
||||
}
|
||||
|
||||
func flattenVinsData(d *schema.ResourceData, vinsRecord *vins.RecordVINS) {
|
||||
@@ -109,6 +110,23 @@ func flattenVinsData(d *schema.ResourceData, vinsRecord *vins.RecordVINS) {
|
||||
d.Set("user_managed", vinsRecord.UserManaged)
|
||||
d.Set("vnfs", flattenVinsRecordVNFs(vinsRecord.VNFs))
|
||||
d.Set("vxlan_id", vinsRecord.VXLANID)
|
||||
d.Set("computes", flattenComputes(vinsRecord.Computes))
|
||||
|
||||
}
|
||||
|
||||
func flattenLibvirtSettings(libvirtSettings vins.LibvirtSettings) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"guid": libvirtSettings.GUID,
|
||||
"txmode": libvirtSettings.TXMode,
|
||||
"ioeventfd": libvirtSettings.IOEventFD,
|
||||
"event_idx": libvirtSettings.EventIDx,
|
||||
"queues": libvirtSettings.Queues,
|
||||
"rx_queue_size": libvirtSettings.RXQueueSize,
|
||||
"tx_queue_size": libvirtSettings.TXQueueSize,
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenVinsVNFDev(vd vins.VNFDev) []map[string]interface{} {
|
||||
@@ -138,6 +156,18 @@ func flattenVinsVNFDev(vd vins.VNFDev) []map[string]interface{} {
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenComputes(computes []vins.Computes) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(computes))
|
||||
for _, compute := range computes {
|
||||
tmp := map[string]interface{}{
|
||||
"id": compute.ID,
|
||||
"name": compute.Name,
|
||||
}
|
||||
res = append(res, tmp)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenVinsRecordVNFs(rv vins.RecordVNFs) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
@@ -393,25 +423,28 @@ func flattenVinsListInterfaces(i vins.ListInterfaces) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0, len(i))
|
||||
for _, v := range i {
|
||||
temp := map[string]interface{}{
|
||||
"conn_id": v.ConnID,
|
||||
"conn_type": v.ConnType,
|
||||
"def_gw": v.DefGW,
|
||||
"enabled": v.Enabled,
|
||||
"flipgroup_id": v.FLIPGroupID,
|
||||
"guid": v.GUID,
|
||||
"ip_address": v.IPAddress,
|
||||
"listen_ssh": v.ListenSSH,
|
||||
"mac": v.MAC,
|
||||
"name": v.Name,
|
||||
"net_id": v.NetID,
|
||||
"net_mask": v.NetMask,
|
||||
"net_type": v.NetType,
|
||||
"node_id": v.NodeID,
|
||||
"pci_slot": v.PCISlot,
|
||||
"qos": flattenVinsQOS(v.QOS),
|
||||
"target": v.Target,
|
||||
"type": v.Type,
|
||||
"vnfs": v.VNFs,
|
||||
"conn_id": v.ConnID,
|
||||
"conn_type": v.ConnType,
|
||||
"def_gw": v.DefGW,
|
||||
"enabled": v.Enabled,
|
||||
"flipgroup_id": v.FLIPGroupID,
|
||||
"guid": v.GUID,
|
||||
"ip_address": v.IPAddress,
|
||||
"listen_ssh": v.ListenSSH,
|
||||
"mac": v.MAC,
|
||||
"mtu": v.MTU,
|
||||
"name": v.Name,
|
||||
"net_id": v.NetID,
|
||||
"net_mask": v.NetMask,
|
||||
"net_type": v.NetType,
|
||||
"node_id": v.NodeID,
|
||||
"pci_slot": v.PCISlot,
|
||||
"bus_number": v.BusNumber,
|
||||
"qos": flattenVinsQOS(v.QOS),
|
||||
"target": v.Target,
|
||||
"type": v.Type,
|
||||
"vnfs": v.VNFs,
|
||||
"libvirt_settings": flattenLibvirtSettings(v.LibvirtSettings),
|
||||
}
|
||||
res = append(res, temp)
|
||||
}
|
||||
|
||||
@@ -64,9 +64,7 @@ func createVinsInAcc(ctx context.Context, d *schema.ResourceData, m interface{},
|
||||
if preReservationsNum, ok := d.GetOk("pre_reservations_num"); ok {
|
||||
req.PreReservationsNum = uint64(preReservationsNum.(int))
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
if routesList, ok := d.GetOk("routes"); ok {
|
||||
var routes []vins.Route
|
||||
var route vins.Route
|
||||
@@ -117,9 +115,7 @@ func createVinsInRG(ctx context.Context, d *schema.ResourceData, m interface{},
|
||||
if preReservationsNum, ok := d.GetOk("pre_reservations_num"); ok {
|
||||
req.PreReservationsNum = uint64(preReservationsNum.(int))
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
if routesList, ok := d.GetOk("routes"); ok {
|
||||
var routes []vins.Route
|
||||
var route vins.Route
|
||||
|
||||
@@ -343,9 +343,6 @@ func resourceVinsDelete(ctx context.Context, d *schema.ResourceData, m interface
|
||||
if permanently, ok := d.GetOk("permanently"); ok {
|
||||
req.Permanently = permanently.(bool)
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
if _, err := c.CloudBroker().VINS().Delete(ctx, req); err != nil {
|
||||
return diag.FromErr(err)
|
||||
@@ -362,9 +359,6 @@ func resourceVinsEnable(ctx context.Context, d *schema.ResourceData, m interface
|
||||
req := vins.EnableRequest{
|
||||
VINSID: vinsId,
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().Enable(ctx, req)
|
||||
return err
|
||||
@@ -376,9 +370,6 @@ func resourceVinsDisable(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
req := vins.DisableRequest{
|
||||
VINSID: vinsId,
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().Disable(ctx, req)
|
||||
return err
|
||||
@@ -390,9 +381,6 @@ func resourceVinsRestore(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
req := vins.RestoreRequest{
|
||||
VINSID: vinsId,
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().Restore(ctx, req)
|
||||
return err
|
||||
@@ -421,9 +409,6 @@ func resourceVinsIpReserve(ctx context.Context, d *schema.ResourceData, m interf
|
||||
if computeId, ok := ip["compute_id"]; ok {
|
||||
req.ComputeID = uint64(computeId.(int))
|
||||
}
|
||||
if reason, ok := ip["reason"]; ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().IPReserve(ctx, req)
|
||||
if err != nil {
|
||||
@@ -459,9 +444,6 @@ func resourceVinsNatRuleAdd(ctx context.Context, d *schema.ResourceData, m inter
|
||||
if proto, ok := natRule["proto"]; ok {
|
||||
req.Proto = proto.(string)
|
||||
}
|
||||
if reason, ok := natRule["reason"]; ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().NATRuleAdd(ctx, req)
|
||||
if err != nil {
|
||||
@@ -505,10 +487,6 @@ func resourceVinsChangeExtNetId(ctx context.Context, d *schema.ResourceData, m i
|
||||
// there was preexisting external net connection - disconnect ViNS
|
||||
req := vins.ExtNetDisconnectRequest{VINSID: vinsId}
|
||||
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().ExtNetDisconnect(ctx, req)
|
||||
return err
|
||||
}
|
||||
@@ -521,9 +499,6 @@ func resourceVinsChangeExtNetId(ctx context.Context, d *schema.ResourceData, m i
|
||||
if ip, ok := d.GetOk("ext_ip"); ok && ip != "" {
|
||||
req.IP = ip.(string)
|
||||
}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().ExtNetConnect(ctx, req)
|
||||
return err
|
||||
@@ -593,9 +568,6 @@ func resourceVinsChangeIp(ctx context.Context, d *schema.ResourceData, m interfa
|
||||
if ip["compute_id"].(int) != 0 {
|
||||
req.ComputeID = uint64(ip["compute_id"].(int))
|
||||
}
|
||||
if ip["reason"].(string) != "" {
|
||||
req.Reason = ip["reason"].(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().IPReserve(ctx, req)
|
||||
if err != nil {
|
||||
@@ -640,9 +612,6 @@ func resourceVinsChangeNatRule(ctx context.Context, d *schema.ResourceData, m in
|
||||
VINSID: vinsId,
|
||||
RuleID: int64(natRule["rule_id"].(int)),
|
||||
}
|
||||
if natRule["reason"].(string) != "" {
|
||||
req.Reason = natRule["reason"].(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().NATRuleDel(ctx, req)
|
||||
errs = append(errs, err)
|
||||
@@ -738,9 +707,6 @@ func resourceVinsChangeVnfRedeploy(ctx context.Context, d *schema.ResourceData,
|
||||
_, newRedeploy := d.GetChange("vnfdev_redeploy")
|
||||
if newRedeploy.(bool) {
|
||||
req := vins.VNFDevRedeployRequest{VINSID: vinsId}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevRedeploy(ctx, req)
|
||||
return err
|
||||
@@ -757,9 +723,6 @@ func resourceVinsChangeVnfRestart(ctx context.Context, d *schema.ResourceData, m
|
||||
_, newRestart := d.GetChange("vnfdev_restart")
|
||||
if newRestart.(bool) {
|
||||
req := vins.VNFDevRestartRequest{VINSID: vinsId}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevRestart(ctx, req)
|
||||
if err != nil {
|
||||
@@ -778,9 +741,6 @@ func resourceVinsChangeVnfReset(ctx context.Context, d *schema.ResourceData, m i
|
||||
_, newRestart := d.GetChange("vnfdev_reset")
|
||||
if newRestart.(bool) {
|
||||
req := vins.VNFDevResetRequest{VINSID: vinsId}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevReset(ctx, req)
|
||||
if err != nil {
|
||||
@@ -799,9 +759,6 @@ func resourceVinsChangeVnfStartStop(ctx context.Context, d *schema.ResourceData,
|
||||
_, newStart := d.GetChange("vnfdev_start")
|
||||
if newStart.(bool) {
|
||||
req := vins.VNFDevStartRequest{VINSID: vinsId}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevStart(ctx, req)
|
||||
if err != nil {
|
||||
@@ -810,9 +767,6 @@ func resourceVinsChangeVnfStartStop(ctx context.Context, d *schema.ResourceData,
|
||||
}
|
||||
|
||||
req := vins.VNFDevStopRequest{VINSID: vinsId}
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
_, err := c.CloudBroker().VINS().VNFDevStop(ctx, req)
|
||||
return err
|
||||
|
||||
@@ -12,11 +12,7 @@ func dataSourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "vins id",
|
||||
},
|
||||
"reason": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "reason for action",
|
||||
},
|
||||
|
||||
"vnf_dev": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -195,6 +191,47 @@ func dataSourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "mac",
|
||||
},
|
||||
"mtu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "mtu",
|
||||
},
|
||||
"libvirt_settings": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"queues": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -224,6 +261,10 @@ func dataSourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "pci slot",
|
||||
},
|
||||
"bus_number": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"qos": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -1445,6 +1486,11 @@ func dataSourceVinsListDeletedSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "Filter by external IP",
|
||||
},
|
||||
"vnf_dev_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Description: "Filter by VNF Device id",
|
||||
},
|
||||
"sort_by": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -1796,11 +1842,7 @@ func DataSourceVinsNatRuleListSchemaMake() map[string]*schema.Schema {
|
||||
Required: true,
|
||||
Description: "Unique ID of the ViNS. If ViNS ID is specified, then ViNS name, rg_id and account_id are ignored.",
|
||||
},
|
||||
"reason": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "reason for action",
|
||||
},
|
||||
|
||||
"items": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
@@ -1967,10 +2009,6 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
},
|
||||
},
|
||||
"reason": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
|
||||
// Additional parameters from CreateInRG
|
||||
"rg_id": {
|
||||
@@ -2032,10 +2070,6 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
},
|
||||
"reason": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -2324,6 +2358,47 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "mac",
|
||||
},
|
||||
"mtu": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "mtu",
|
||||
},
|
||||
"libvirt_settings": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Resource{
|
||||
Schema: map[string]*schema.Schema{
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"txmode": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"ioeventfd": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"event_idx": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"queues": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"rx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"tx_queue_size": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"name": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
@@ -2353,6 +2428,11 @@ func resourceVinsSchemaMake() map[string]*schema.Schema {
|
||||
Computed: true,
|
||||
Description: "pci slot",
|
||||
},
|
||||
"bus_number": {
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
Description: "bus number",
|
||||
},
|
||||
"qos": {
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
|
||||
@@ -56,10 +56,6 @@ func utilityVinsCheckPresence(ctx context.Context, d *schema.ResourceData, m int
|
||||
req.VINSID = uint64(d.Get("vins_id").(int))
|
||||
}
|
||||
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
vins, err := c.CloudBroker().VINS().Get(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -69,6 +69,9 @@ func utilityVinsListDeletedCheckPresence(ctx context.Context, d *schema.Resource
|
||||
if size, ok := d.GetOk("size"); ok {
|
||||
req.Size = uint64(size.(int))
|
||||
}
|
||||
if VNFDevId, ok := d.GetOk("vnfdev_id"); ok {
|
||||
req.VNFDevId = uint64(VNFDevId.(int))
|
||||
}
|
||||
|
||||
log.Debugf("utilityVinsListDeletedCheckPresence")
|
||||
vinsList, err := c.CloudBroker().VINS().ListDeleted(ctx, req)
|
||||
|
||||
@@ -52,10 +52,6 @@ func utilityVinsNatRuleListCheckPresence(ctx context.Context, d *schema.Resource
|
||||
req.VINSID = uint64(d.Get("vins_id").(int))
|
||||
}
|
||||
|
||||
if reason, ok := d.GetOk("reason"); ok {
|
||||
req.Reason = reason.(string)
|
||||
}
|
||||
|
||||
natRuleList, err := c.CloudBroker().VINS().NATRuleList(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user