Configuring a VLAN

The first part of this article explains how to configure a VLAN using the FlexSwitch CLI and the second part explains the process using the REST interface with examples in cURL.

In this example we create an ID of 100 whos name is vlan100 and attach it to the interface fpPort1.

Using the CLI to Configure a VLAN

The following steps explain how to create a BGP Neighbor using the FlexSwitch CLI. See Accessing the Command Line Reference for more information about logging into the CLI facility.

Configuring a VLAN on an interface is a two part process:

  • Create a Vlan object.
  • Associate the Vlan object with an interface.

Create a Vlan Object

This step creates a Vlan object whos VlanId is 100 and whos name is vlan100.

localhost(config)#vlan 100
localhost(config-vlan)#

Verify the Configuration Information

localhost(config-vlan)#showunapplied
Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.


id: 5 object: Vlan status: PENDING CONFIG valid: True delete: False num user cmds: 1
command attr value model attr iskey required userprov time provisioned
------------------------------------------------------------------------------------------------------
vlan 100 vlan 100 VlanId True X X Wed May 10 17:42:41 2017

Apply the Configuration

localhost(config-vlan)#apply
Applying Config:
id: 5 object: Vlan   status: APPLIED CONFIG  valid: True delete: False num user cmds: 1
 command     attr    value    model attr    iskey    required    userprov    time provisioned        
------------------------------------------------------------------------------------------------------
 vlan 100    vlan    100      VlanId        True     X           X           Wed May 10 17:42:41 2017


sdk:createVlan(100,None,None,AdminState=UP,Description=none,AutoState=UP) result: SUCCESS: http status code: 201

Verigy the Object After Applying

localhost(config)#show vlan
Applying Show:


 VLAN    Name       Status    Ports
------------------------------------
 100     vlan100    DOWN      ,    
sdk:printCombinedVlanStates() result: SUCCESS


localhost(config)#

Using the REST Interface (cURL) to Configure a VLAN

Configuring a VLAN and associating it with an interface is a single REST request as shown below.

curl -k -u <user>:<password> -H "Content-Type: application/json" -d '{"VlanId":100,"IntfList":["fpPort1"]}' http://172.17.0.2:443/public/v1/config/vlan