Skip to content

Commit

Permalink
B #405: create ovs network without vlan id
Browse files Browse the repository at this point in the history
  • Loading branch information
treywelsh committed Feb 13, 2023
1 parent 0a97ac7 commit 87262d8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions opennebula/resource_opennebula_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,8 @@ func changeVNetGroup(d *schema.ResourceData, meta interface{}) error {
return nil
}

func validVlanType(intype string) int {
vlanType := []string{"802.1Q", "vxlan", "ovswitch"}
return inArray(intype, vlanType)
func mandatoryVLAN(intype string) bool {
return inArray(intype, []string{"802.1Q", "vxlan"}) >= 0
}

func resourceOpennebulaVirtualNetworkCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand Down Expand Up @@ -804,7 +803,7 @@ func generateVn(d *schema.ResourceData) (string, error) {
tpl.Add(vnk.Name, vnname)
tpl.Add(vnk.VNMad, vnmad)

if validVlanType(vnmad) >= 0 {
if mandatoryVLAN(vnmad) {
if d.Get("automatic_vlan_id") == true {
tpl.Add("AUTOMATIC_VLAN_ID", "YES")
} else if vlanid, ok := d.GetOk("vlan_id"); ok {
Expand Down

0 comments on commit 87262d8

Please sign in to comment.