VLAN Commands

show vlan id 2

show vlan id 2
import requests
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
 "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show vlan id 2",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)

{
 "ins_api":	{
        "type":	"cli_show",
        "version":	"1.2",
        "sid":	"eoc",
        "outputs":	{
            "output":	{
                "input": "show vlan id 2",
                "msg":	"Success",
                "code":	"200",
                "body":	{
                    "vlanshowrspan-vlantype":	"notrspan",
                    "is-vtp-manageable":	"enabled",
                    "TABLE_mtuinfoid":	{
                        "ROW_mtuinfoid":	{
                            "vlanshowinfo-vlanid":	"2",
                            "vlanshowinfo-media-type":	"enet",
                            "vlanshowinfo-vlanmode":	"ce-vlan"
                        }
                    },
                    "TABLE_vlanbriefid":	{
                        "ROW_vlanbriefid":	{
                            "vlanshowbr-vlanid":	"33554432",
                            "vlanshowbr-vlanid-utf":	"2",
                            "vlanshowbr-vlanname":	"VLAN0002",
                            "vlanshowbr-vlanstate":	"active",
                            "vlanshowbr-shutstate":	"noshutdown",
                            "vlanshowplist-ifidx":	"Ethernet9/1-2,Ethernet9/20"
                        }
                    }
                }
            }
        }
    }

}

To display information and statistics for an individual VLAN or a range of VLANs, use the show vlan id command.

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).

CLI Output

switch# **show vlan id 2**

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
2    VLAN0002                         active    Po22, Eth9/1, Eth9/2, Eth9/33

VLAN Type Vlan-mode


2 enet CE

Remote SPAN VLAN

Disabled

Primary Secondary Type Ports


show vlan

show vlan
import requests
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
 "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show vlan",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)

{
    "ins_api":	{
        "type":	"cli_show",
        "version":	"1.2",
        "sid":	"eoc",
        "outputs":	{
            "output":	{
                "input": "show vlan",
                "msg":	"Success",
                "code":	"200",
                "body":	{
                    "TABLE_vlanbrief":	{
                        "ROW_vlanbrief":	[{
                                "vlanshowbr-vlanid":	"16777216",
                                "vlanshowbr-vlanid-utf":	"1",
                                "vlanshowbr-vlanname":	"default",
                                "vlanshowbr-vlanstate":	"active",
                                "vlanshowbr-shutstate":	"noshutdown",
                                "vlanshowplist-ifidx":	"port-channel12,port-channel123"
                            }, {
                                "vlanshowbr-vlanid":	"33554432",
                                "vlanshowbr-vlanid-utf":	"2",
                                "vlanshowbr-vlanname":	"VLAN0002",
                                "vlanshowbr-vlanstate":	"active",
                                "vlanshowbr-shutstate":	"noshutdown",
                                "vlanshowplist-ifidx":	"Ethernet9/1-2,Ethernet9/20"
                            }]
                    },
                    "TABLE_mtuinfo":	{
                        "ROW_mtuinfo":	[{
                                "vlanshowinfo-vlanid":	"1",
                                "vlanshowinfo-media-type":	"enet",
                                "vlanshowinfo-vlanmode":	"ce-vlan"
                            }, {
                                "vlanshowinfo-vlanid":	"2",
                                "vlanshowinfo-media-type":	"enet",
                                "vlanshowinfo-vlanmode":	"ce-vlan"
                            }]
                    }
                }
            }
        }
    }
}

To display information for an individual VLAN, use show vlan command.

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).

CLI Output

switch# **show vlan**

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Po12, Po123
2    VLAN0002                         active    Po22, Eth9/1, Eth9/2, Eth9/33
63   VLAN0063                         active

VLAN Type Vlan-mode


1 enet CE 2 enet CE 63 enet CE

Remote SPAN VLANs

Primary Secondary Type Ports


show vlan all-ports

show vlan all-ports
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show vlan all-ports",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "TABLE_vlanbriefallports": {
    "ROW_vlanbriefallports": [
      {
        "vlanshowbr-vlanid": 1, 
        "vlanshowbr-vlanid-utf": 1, 
        "vlanshowbr-vlanname": "default", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet2/27,Ethernet6/21,Ethernet6/27"
      }, 
      {
        "vlanshowbr-vlanid": 2, 
        "vlanshowbr-vlanid-utf": 2, 
        "vlanshowbr-vlanname": "VLAN0002", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet6/21"
      }, 
      {
        "vlanshowbr-vlanid": 3, 
        "vlanshowbr-vlanid-utf": 3, 
        "vlanshowbr-vlanname": "VLAN0003", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet6/21"
      }, 
      {
        "vlanshowbr-vlanid": 4, 
        "vlanshowbr-vlanid-utf": 4, 
        "vlanshowbr-vlanname": "VLAN0004", 
switch# show vlan all-ports | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:8.3.1.:vlan_mgr_cli" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <vlan>
    <all-ports>
     <__readonly__>
      <TABLE_vlanbriefallports>
       <ROW_vlanbriefallports>
        <vlanshowbr-vlanid>1</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>1</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>default</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet2/27,Ethernet6/21,Ethernet6/27</vlanshowplist-ifidx>
       </ROW_vlanbriefallports>
       <ROW_vlanbriefallports>
        <vlanshowbr-vlanid>2</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>2</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>VLAN0002</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet6/21</vlanshowplist-ifidx>
       </ROW_vlanbriefallports>
       <ROW_vlanbriefallports>
        <vlanshowbr-vlanid>3</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>3</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>VLAN0003</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet6/21</vlanshowplist-ifidx>
       </ROW_vlanbriefallports>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).

CLI Output

switch# **show vlan all-ports**

switch# show vlan all-ports

VLAN Name Status Ports


1 default active Eth2/27, Eth6/21, Eth6/27 2 VLAN0002 active Eth6/21 3 VLAN0003 active Eth6/21 4 VLAN0004 active Eth6/21 5 VLAN0005 active Eth6/21 6 VLAN0006 active Eth6/21 7 VLAN0007 active Eth6/21 8 VLAN0008 active Eth6/21 9 VLAN0009 active Eth6/21 10 VLAN0010 active Eth6/21 11 VLAN0011 active Eth6/21 12 VLAN0012 active Eth6/21 13 VLAN0013 active Eth6/21 14 VLAN0014 active Eth6/21 15 VLAN0015 active Eth6/21 16 VLAN0016 active Eth6/21 17 VLAN0017 active Eth6/21 18 VLAN0018 active Eth6/21 19 VLAN0019 active Eth6/21 20 VLAN0020 active Eth6/21 21 VLAN0021 active Eth6/21 22 VLAN0022 active Eth6/21 23 VLAN0023 active Eth6/21 24 VLAN0024 active Eth6/21 25 VLAN0025 active Eth6/21 26 VLAN0026 active Eth6/21 27 VLAN0027 active Eth6/21 28 VLAN0028 active Eth6/21

show vlan brief

show vlan brief
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show vlan brief",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "TABLE_vlanbriefxbrief": {
    "ROW_vlanbriefxbrief": [
      {
        "vlanshowbr-vlanid": 1, 
        "vlanshowbr-vlanid-utf": 1, 
        "vlanshowbr-vlanname": "default", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet2/27,Ethernet6/21,Ethernet6/27"
      }, 
      {
        "vlanshowbr-vlanid": 2, 
        "vlanshowbr-vlanid-utf": 2, 
        "vlanshowbr-vlanname": "VLAN0002", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet6/21"
      }, 
      {
        "vlanshowbr-vlanid": 3, 
        "vlanshowbr-vlanid-utf": 3, 
        "vlanshowbr-vlanname": "VLAN0003", 
        "vlanshowbr-vlanstate": "active", 
        "vlanshowbr-shutstate": "noshutdown", 
        "vlanshowplist-ifidx": "Ethernet6/21"
      }, 
      {
        "vlanshowbr-vlanid": 4, 
        "vlanshowbr-vlanid-utf": 4, 
        "vlanshowbr-vlanname": "VLAN0004", 
switch# show vlan brief | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:8.3.1.:vlan_mgr_cli" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <vlan>
    <brief>
     <__readonly__>
      <TABLE_vlanbriefxbrief>
       <ROW_vlanbriefxbrief>
        <vlanshowbr-vlanid>1</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>1</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>default</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet2/27,Ethernet6/21,Ethernet6/27</vlanshowplist-ifidx>
       </ROW_vlanbriefxbrief>
       <ROW_vlanbriefxbrief>
        <vlanshowbr-vlanid>2</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>2</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>VLAN0002</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet6/21</vlanshowplist-ifidx>
       </ROW_vlanbriefxbrief>
       <ROW_vlanbriefxbrief>
        <vlanshowbr-vlanid>3</vlanshowbr-vlanid>
        <vlanshowbr-vlanid-utf>3</vlanshowbr-vlanid-utf>
        <vlanshowbr-vlanname>VLAN0003</vlanshowbr-vlanname>
        <vlanshowbr-vlanstate>active</vlanshowbr-vlanstate>
        <vlanshowbr-shutstate>noshutdown</vlanshowbr-shutstate>
        <vlanshowplist-ifidx>Ethernet6/21</vlanshowplist-ifidx>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).

CLI Output

switch# **show vlan brief**

switch# show vlan brief

VLAN Name Status Ports


1 default active Eth2/27, Eth6/21, Eth6/27 2 VLAN0002 active Eth6/21 3 VLAN0003 active Eth6/21 4 VLAN0004 active Eth6/21 5 VLAN0005 active Eth6/21 6 VLAN0006 active Eth6/21 7 VLAN0007 active Eth6/21 8 VLAN0008 active Eth6/21 9 VLAN0009 active Eth6/21 10 VLAN0010 active Eth6/21 11 VLAN0011 active Eth6/21 12 VLAN0012 active Eth6/21 13 VLAN0013 active Eth6/21 14 VLAN0014 active Eth6/21 15 VLAN0015 active Eth6/21 16 VLAN0016 active Eth6/21 17 VLAN0017 active Eth6/21 18 VLAN0018 active Eth6/21 19 VLAN0019 active Eth6/21 20 VLAN0020 active Eth6/21 21 VLAN0021 active Eth6/21 22 VLAN0022 active Eth6/21 23 VLAN0023 active Eth6/21 24 VLAN0024 active Eth6/21 25 VLAN0025 active Eth6/21 26 VLAN0026 active Eth6/21 27 VLAN0027 active Eth6/21 28 VLAN0028 active Eth6/21

show vlan summary

show vlan summary
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show vlan summary",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "vlansum-all-vlan": 1004, 
  "vlansum-vtp-vlan": 1000, 
  "vlansum-ext-vlan": 4, 
  "vlansum-max-supported-vlan": 4094
}
switch# show vlan summary | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:8.3.1.:vlan_mgr_cli" xmlns:nf="urn:ietf:params:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <vlan>
    <summary>
     <__readonly__>
      <vlansum-all-vlan>1004</vlansum-all-vlan>
      <vlansum-vtp-vlan>1000</vlansum-vtp-vlan>
      <vlansum-ext-vlan>4</vlansum-ext-vlan>
      <vlansum-max-supported-vlan>4094</vlansum-max-supported-vlan>
     </__readonly__>
    </summary>
   </vlan>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).

CLI Output

switch# **show vlan summary**

switch# show vlan summary

Number of existing VLANs : 1004 Number of existing user VLANs : 1000 Number of existing extended VLANs : 4 Number of maximum VLANs : 4094