show port-channel database

show port-channel database
import requests
import json

"""
Modify these please
"""
url='http://<ip_address>:<port_number>/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 port-channel database",
  "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)

json_output = json.loads(output)["ins_api"]["outputs"]["output"]["body"]
print(json.dumps(json_output, indent=4, sort_keys=True))
{
    "TABLE_port_channel_database": {
        "ROW_port_channel_database": [
            {
                "TABLE_port_channel_member": {
                    "ROW_port_channel_member": {
                        "port": "fcip1",
                        "state": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel1",
                "last_membership_update": "succeeded",
                "total_oper_ports": 0,
                "total_ports": 1
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel2",
                "last_membership_update": "succeeded"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel3",
                "last_membership_update": "succeeded"
            },
            {
                "TABLE_port_channel_member": {
                    "ROW_port_channel_member": {
                        "port": "fc1/14",
                        "state": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel4",
                "last_membership_update": "succeeded",
                "total_oper_ports": 0,
                "total_ports": 1
            },
            {
                "TABLE_port_channel_member": {
                    "ROW_port_channel_member": [
                        {
                            "port": "fc1/19",
                            "state": "down"
                        },
                        {
                            "port": "fc1/25",
                            "state": "up"
                        }
                    ]
                },
                "admin_channel_mode": "active",
                "first_operational_port": "fc1/25",
                "interface": "port-channel5",
                "last_membership_update": "succeeded",
                "total_oper_ports": 1,
                "total_ports": 2
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel6",
                "last_membership_update": "succeeded"
            },
            {
                "TABLE_port_channel_member": {
                    "ROW_port_channel_member": {
                        "port": "fc1/9",
                        "state": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel10",
                "last_membership_update": "succeeded",
                "total_oper_ports": 0,
                "total_ports": 1
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel20",
                "last_membership_update": "succeeded"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel100",
                "last_membership_update": "succeeded"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel200",
                "last_membership_update": "succeeded"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel201",
                "last_membership_update": "succeeded"
            }
        ]
    }
}
      <TABLE_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel1</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
        <total_ports>1</total_ports>
        <total_oper_ports>0</total_oper_ports>
        <TABLE_port_channel_member>
         <ROW_port_channel_member>
          <port>fcip1</port>
          <state>down</state>
         </ROW_port_channel_member>
        </TABLE_port_channel_member>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel2</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel3</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel4</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
        <total_ports>1</total_ports>
        <total_oper_ports>0</total_oper_ports>
        <TABLE_port_channel_member>
         <ROW_port_channel_member>
          <port>fc1/14</port>
          <state>down</state>
         </ROW_port_channel_member>
        </TABLE_port_channel_member>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel5</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
        <first_operational_port>fc1/25</first_operational_port>
        <total_ports>2</total_ports>
        <total_oper_ports>1</total_oper_ports>
        <TABLE_port_channel_member>
         <ROW_port_channel_member>
          <port>fc1/19</port>
          <state>down</state>
         </ROW_port_channel_member>
         <ROW_port_channel_member>
          <port>fc1/25</port>
          <state>up</state>
         </ROW_port_channel_member>
        </TABLE_port_channel_member>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel6</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel10</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
        <total_ports>1</total_ports>
        <total_oper_ports>0</total_oper_ports>
        <TABLE_port_channel_member>
         <ROW_port_channel_member>
          <port>fc1/9</port>
          <state>down</state>
         </ROW_port_channel_member>
        </TABLE_port_channel_member>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel20</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel100</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel200</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
       <ROW_port_channel_database>
        <interface>port-channel201</interface>
        <admin_channel_mode>active</admin_channel_mode>
        <last_membership_update>succeeded</last_membership_update>
       </ROW_port_channel_database>
      </TABLE_port_channel_database>

The show port-channel database command displays the Port-Channel database entries. For command descriptions, see the Cisco MDS 9000 Series Switches Command References.

Note: This sample output is generated for Cisco MDS 9000 Series NX-OS Release 8.4(2a) or later.

CLI Output
switch# show port-channel database

port-channel1
Administrative channel mode is active
Last membership update succeeded
1 port in total, 0 ports up
Ports: fcip1 [down]

port-channel2
Administrative channel mode is active
Last membership update succeeded
No port

port-channel3
Administrative channel mode is active
Last membership update succeeded
No port

port-channel4
Administrative channel mode is active
Last membership update succeeded
1 port in total, 0 ports up
Ports: fc1/14 [down]

port-channel5
Administrative channel mode is active
Last membership update succeeded
First operational port is fc1/25
2 ports in total, 1 port up
Ports: fc1/19 [down]
fc1/25 [up] *

port-channel6
Administrative channel mode is active
Last membership update succeeded
fcip-enhanced
No port

port-channel10
Administrative channel mode is active
Last membership update succeeded
1 port in total, 0 ports up
Ports: fc1/9 [down]

port-channel20
Administrative channel mode is active
Last membership update succeeded
No port

port-channel100
Administrative channel mode is active
Last membership update succeeded
No port

port-channel200
Administrative channel mode is active
Last membership update succeeded
No port

port-channel201
Administrative channel mode is active
Last membership update succeeded
No port
ParameterDescriptionTypeSample Values
last_membership_updateLast membership update statusString['succeeded', ' failed']
stateMember interface stateString['up', ' down']
admin_channel_modePort channel administrative channel modeString['on', ' active']
interfacePort channel interfaceString
first_operational_portFirst operational port in a port channelString
portPort channel member interfaceString
total_portsTotal number of interfaces in the port channelInteger
total_oper_portsTotal operational interfaces in the port channelInteger

show port-channel database detail

show port-channel database  detail
import requests
import json

"""
Modify these please
"""
url='http://<ip_address>:<port_number>/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 port-channel database  detail",
  "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)

json_output = json.loads(output)["ins_api"]["outputs"]["output"]["body"]
print(json.dumps(json_output, indent=4, sort_keys=True))
{
    "TABLE_port_channel_database": {
        "ROW_port_channel_database": [
            {
                "TABLE_port_channel_member_detail": {
                    "ROW_port_channel_member_detail": {
                        "channel_mode": "--",
                        "local_wwn": "00:00:00:00:00:00:00:00",
                        "mode": "--",
                        "peer_wwn": "00:00:00:00:00:00:00:00",
                        "port": "fcip1",
                        "port_up_time": "--",
                        "status": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel1"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel2"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel3"
            },
            {
                "TABLE_port_channel_member_detail": {
                    "ROW_port_channel_member_detail": {
                        "channel_mode": "--",
                        "local_wwn": "00:00:00:00:00:00:00:00",
                        "mode": "--",
                        "peer_wwn": "00:00:00:00:00:00:00:00",
                        "port": "fc1/14",
                        "port_up_time": "--",
                        "status": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel4"
            },
            {
                "TABLE_port_channel_member_detail": {
                    "ROW_port_channel_member_detail": [
                        {
                            "channel_mode": "--",
                            "local_wwn": "00:00:00:00:00:00:00:00",
                            "mode": "--",
                            "peer_wwn": "00:00:00:00:00:00:00:00",
                            "port": "fc1/19",
                            "port_up_time": "--",
                            "status": "down"
                        },
                        {
                            "channel_mode": "active",
                            "local_wwn": "20:19:00:2a:6a:fd:04:a0",
                            "mode": "E",
                            "peer_wwn": "21:19:8c:60:4f:54:54:00",
                            "port": "fc1/25",
                            "port_up_time": "1976-03-23T16:08:08Z",
                            "status": "up"
                        }
                    ]
                },
                "admin_channel_mode": "active",
                "interface": "port-channel5"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel6"
            },
            {
                "TABLE_port_channel_member_detail": {
                    "ROW_port_channel_member_detail": {
                        "channel_mode": "--",
                        "local_wwn": "00:00:00:00:00:00:00:00",
                        "mode": "--",
                        "peer_wwn": "00:00:00:00:00:00:00:00",
                        "port": "fc1/9",
                        "port_up_time": "--",
                        "status": "down"
                    }
                },
                "admin_channel_mode": "active",
                "interface": "port-channel10"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel20"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel100"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel200"
            },
            {
                "admin_channel_mode": "active",
                "interface": "port-channel201"
            }
        ]
    }
}
       <TABLE_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel1</interface>
         <admin_channel_mode>active</admin_channel_mode>
         <TABLE_port_channel_member_detail>
          <ROW_port_channel_member_detail>
           <port>fcip1</port>
           <channel_mode>--</channel_mode>
           <status>down</status>
           <mode>--</mode>
           <local_wwn>00:00:00:00:00:00:00:00</local_wwn>
           <peer_wwn>00:00:00:00:00:00:00:00</peer_wwn>
           <port_up_time>--</port_up_time>
          </ROW_port_channel_member_detail>
         </TABLE_port_channel_member_detail>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel2</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel3</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel4</interface>
         <admin_channel_mode>active</admin_channel_mode>
         <TABLE_port_channel_member_detail>
          <ROW_port_channel_member_detail>
           <port>fc1/14</port>
           <channel_mode>--</channel_mode>
           <status>down</status>
           <mode>--</mode>
           <local_wwn>00:00:00:00:00:00:00:00</local_wwn>
           <peer_wwn>00:00:00:00:00:00:00:00</peer_wwn>
           <port_up_time>--</port_up_time>
          </ROW_port_channel_member_detail>
         </TABLE_port_channel_member_detail>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel5</interface>
         <admin_channel_mode>active</admin_channel_mode>
         <TABLE_port_channel_member_detail>
          <ROW_port_channel_member_detail>
           <port>fc1/19</port>
           <channel_mode>--</channel_mode>
           <status>down</status>
           <mode>--</mode>
           <local_wwn>00:00:00:00:00:00:00:00</local_wwn>
           <peer_wwn>00:00:00:00:00:00:00:00</peer_wwn>
           <port_up_time>--</port_up_time>
          </ROW_port_channel_member_detail>
          <ROW_port_channel_member_detail>
           <port>fc1/25</port>
           <channel_mode>active</channel_mode>
           <status>up</status>
           <mode>E</mode>
           <local_wwn>20:19:00:2a:6a:fd:04:a0</local_wwn>
           <peer_wwn>21:19:8c:60:4f:54:54:00</peer_wwn>
           <port_up_time>1976-03-23T16:08:08Z</port_up_time>
          </ROW_port_channel_member_detail>
         </TABLE_port_channel_member_detail>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel6</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel10</interface>
         <admin_channel_mode>active</admin_channel_mode>
         <TABLE_port_channel_member_detail>
          <ROW_port_channel_member_detail>
           <port>fc1/9</port>
           <channel_mode>--</channel_mode>
           <status>down</status>
           <mode>--</mode>
           <local_wwn>00:00:00:00:00:00:00:00</local_wwn>
           <peer_wwn>00:00:00:00:00:00:00:00</peer_wwn>
           <port_up_time>--</port_up_time>
          </ROW_port_channel_member_detail>
         </TABLE_port_channel_member_detail>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel20</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel100</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel200</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
        <ROW_port_channel_database>
         <interface>port-channel201</interface>
         <admin_channel_mode>active</admin_channel_mode>
        </ROW_port_channel_database>
       </TABLE_port_channel_database>

The show port-channel database detail command displays the detailed information of the Port-Channel entries. For command descriptions, see the Cisco MDS 9000 Series Switches Command References.

Note: This sample output is generated for Cisco MDS 9000 Series NX-OS Release 8.4(2a) or later.

CLI Output
switch# show port-channel database  detail

port-channel1
Administrative channel mode is active
Ports:
---------------------------------------------------------------------------------------------------------------
Interface Channel Port Port Local WWN Peer WWN Port Up Time
mode Status Mode
(oper)
---------------------------------------------------------------------------------------------------------------
fcip1 -- down -- 00:00:00:00:00:00:00:00 00:00:00:00:00:00:00:00 --

port-channel2
Administrative channel mode is active
No port

port-channel3
Administrative channel mode is active
No port

port-channel4
Administrative channel mode is active
Ports:
---------------------------------------------------------------------------------------------------------------
Interface Channel Port Port Local WWN Peer WWN Port Up Time
mode Status Mode
(oper)
---------------------------------------------------------------------------------------------------------------
fc1/14 -- down -- 00:00:00:00:00:00:00:00 00:00:00:00:00:00:00:00 --

port-channel5
Administrative channel mode is active
Ports:
---------------------------------------------------------------------------------------------------------------
Interface Channel Port Port Local WWN Peer WWN Port Up Time
mode Status Mode
(oper)
---------------------------------------------------------------------------------------------------------------
fc1/19 -- down -- 00:00:00:00:00:00:00:00 00:00:00:00:00:00:00:00 --
* fc1/25 active up E 20:19:00:2a:6a:fd:04:a0 21:19:8c:60:4f:54:54:00 1976-03-23T16:08:08Z

port-channel6
Administrative channel mode is active
No port

port-channel10
Administrative channel mode is active
Ports:
---------------------------------------------------------------------------------------------------------------
Interface Channel Port Port Local WWN Peer WWN Port Up Time
mode Status Mode
(oper)
---------------------------------------------------------------------------------------------------------------
fc1/9 -- down -- 00:00:00:00:00:00:00:00 00:00:00:00:00:00:00:00 --

port-channel20
Administrative channel mode is active
No port

port-channel100
Administrative channel mode is active
No port

port-channel200
Administrative channel mode is active
No port

port-channel201
Administrative channel mode is active
No port
ParameterDescriptionTypeSample Values
statusMember interface stateString['up', ' down']
channel_modeMember interface channel modeString['on', ' active']
admin_channel_modePort channel administrative channel modeString['on', ' active']
modeMember interface modeString['NP', ' E', ' F']
interfacePort channel interfaceString
portPort channel member interfaceString
local_wwnMember interface local WWNString
peer_wwnMember interface peer WWNString
port_up_timeMember interface up timeString