Forum Discussion

jnunham_332885's avatar
jnunham_332885
Icon for Altostratus rankAltostratus
Sep 08, 2017

Syntax of Get-F5.iControl.NetworkingVLAN.Begincreate_v2

Hello,   I'm trying to write a PowerShell script that will be used to automate the deployment of our F5 LTMs. I want to be able to use this script to lay down a base template instead of having to c...
  • jnunham_332885's avatar
    Sep 08, 2017

    I didn't realize it at the time, but there is an article that explains how to use this:

     

    https://devcentral.f5.com/codeshare?sid=183

     

    Here is the code that works if this can help anyone else in the future! I needed to create VLANs that were both tagged and untagged, so I just made 2 functions for each. I'm only listing the tagged VLAN function here, but if you want to make an untagged one then just change the value of member.tag_state to UNTAGGED instead of TAGGED.

     

    function Create-Tagged-VLAN()
    
    {
      param([string]$name,
        [long]$id,
        [string]$member_name);
    
    $vlans = (, $name);
      $vlan_ids = (, $id);
      $member = New-Object -TypeName iControl.NetworkingVLANMemberEntry;
      $member.member_name = $member_name
      $member.member_type = "MEMBER_INTERFACE";
      $member.tag_state = "MEMBER_Tagged"
      $memberA = (, $member);
      $memberAofA = (, $memberA);
      $failsafe_states = (, "STATE_DISABLED");
      $timeouts = (, 1500);
      $mac_masquerade = (, "");
    
    $iControl.NetworkingVLAN.create(
        $vlans,
        $vlan_ids,
        $memberAofA,
        $failsafe_states,
        $timeouts,
        $mac_masquerade);
    }
    
    Create-Tagged-VLAN -name "VLAN-500" -id 500 -member_name "1.4";