Configuring Port Channels

This section contains payload examples to demonstrate how to use the NX-API REST API to configure port channels on the Cisco Nexus 3000 and 9000 Series switches.

See Configuring Virtual Port Channels for detailed information about configuring virtual port channels.

Creating Port Channels

Creating Port Channels
POST http://<mgmt0_IP>/api/mo/sys.json
{
  "topSystem": {
    "children": [
      {
        "interfaceEntity": {
          "children": [
            {
              "l1PhysIf": {
                "attributes": {
                  "id": "eth1/1"
                }
              }
            },
            {
              "pcAggrIf": {
                "attributes": {
                  "id": "po10",
                  "isExplicit": "yes",
                  "pcMode": "active"
                },
                "children": [
                  {
                    "pcRsMbrIfs": {
                      "attributes": {
                        "tDn": "sys/intf/phys-[eth1/1]"
                      }
                    }
                  }
                ]
              }
            },
            {
              "pcAggrIf": {
                "attributes": {
                  "accessVlan": "vlan-20",
                  "adminSt": "down",
                  "bw": "20000",
                  "delay": "20",
                  "descr": "test port-channel",
                  "duplex": "full",
                  "id": "po1",
                  "layer": "Layer2",
                  "linkLog": "enable",
                  "minLinks": "5",
                  "mode": "trunk",
                  "mtu": "1750",
                  "snmpTrapSt": "disable",
                  "speed": "40G",
                  "trunkLog": "enable",
                  "trunkVlans": "2-20",
                  "userCfgdFlags": "admin_layer,admin_mtu,admin_state"
                }
              }
            }
          ]
        }
      }
    ]
  }
}
{
    imdata:[]
}

  <intf-items>
    <phys-items>
      <PhysIf-list>
        <id>eth1/1</id>
      </PhysIf-list>
    </phys-items>
    <aggr-items>
      <AggrIf-list>
        <id>po10</id>
        <isExplicit>true</isExplicit>
        <pcMode>active</pcMode>
        <rsmbrIfs-items>
          <RsMbrIfs-list>
            <tDn>/System/intf-items/phys-items/PhysIf-list[id='eth1/1']</tDn>
          </RsMbrIfs-list>
        </rsmbrIfs-items>
      </AggrIf-list>
      <AggrIf-list>
        <id>po1</id>
        <accessVlan>vlan-20</accessVlan>
        <adminSt>down</adminSt>
        <bw>20000</bw>
        <delay>20</delay>
        <descr>test port-channel</descr>
        <duplex>full</duplex>
        <layer>Layer2</layer>
        <linkLog>enable</linkLog>
        <minLinks>5</minLinks>
        <mode>trunk</mode>
        <mtu>1750</mtu>
        <snmpTrapSt>disable</snmpTrapSt>
        <speed>40G</speed>
        <trunkLog>enable</trunkLog>
        <trunkVlans>2-20</trunkVlans>
        <userCfgdFlags>admin_layer,admin_mtu,admin_state</userCfgdFlags>
      </AggrIf-list>
    </aggr-items>
  </intf-items>


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

int port-channel 1  shutdown
 description “test port-channel”
 mtu 1750
 duplex full
 no snmp trap link-status
 speed 40000
 switchport
 switchport mode trunk
 switchport access vlan 20
 switchport trunk allowed vlan 2-20
 bandwidth 20000
 delay 20
 logging event port link-status
 logging event port trunk-status
 lacp min-links 5
 int eth1/1
 channel-group 10 mode active


Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.

MODN
topSystem sys
interfaceEntity sys/intf
l1PhysIf sys/intf/phys-[eth1/1]
pcAggrIf sys/intf/aggr-{[id]}
pcAggrIf sys/intf/aggr-{[id]}
pcRsMbrIfs sys/intf/aggr-{[id]}/rsmbrIfs-[sys/intf/phys-[eth1/1]}
pcAggrIf sys/intf/aggr-{[id]}
pcAggrIf sys/intf/aggr-{[id]}


l1PhysIf Properties

The following table contains information about the l1PhysIf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
idnw:IfId
(base:IfIndex)
An identifier .Must match first field in the output of show intf brief. Example: Eth1/1 or Vlan100


pcAggrIf Properties

The following table contains information about the pcAggrIf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
idnw:IfId
(base:IfIndex)
An identifier .Must match first field in the output of show intf brief. Example: Eth1/1 or Vlan100
isExplicitscalar:Bool
PC Created ExplicitlySELECTION: true or false
DEFAULT: true
pcModepc:Mode
(scalar:Enum8)
The aggregated interface protocol channel mode.SELECTION:
0 - on
1 - static
2 - active
3 - passive
4 - mac-pin
DEFAULT: on


pcRsMbrIfs Properties

The following table contains information about the pcRsMbrIfs properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
tDn
reln:Dn
reference:BinRef
null


pcAggrIf Properties

The following table contains information about the pcAggrIf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
idnw:IfId
(base:IfIndex)
An identifier .Must match first field in the output of show intf brief. Example: Eth1/1 or Vlan100
isExplicitscalar:Bool
PC Created ExplicitlySELECTION: true or false
DEFAULT: true
pcModepc:Mode
(scalar:Enum8)
The aggregated interface protocol channel mode.SELECTION:
0 - on
1 - static
2 - active
3 - passive
4 - mac-pin
DEFAULT: on


Related Documentation

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:

https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Creating Port-Channel Members

Creating Port-Channel Members
POST http://<mgmt0_IP>/api/mo/sys.json
{
  "topSystem": {
    "children": [
      {
        "interfaceEntity": {
          "children": [
            {
              "pcAggrIf": {
                "attributes": {
                  "id": "po10",
                  "isExplicit": "no",
                  "pcMode": "on"
                },
                "children": [
                  {
                    "pcRsMbrIfs": {
                      "attributes": {
                        "isMbrForce": "yes",
                        "tDn": "sys/intf/phys-[eth1/1]"
                      }
                    }
                  }
                ]
              }
            },
            {
              "l1PhysIf": {
                "attributes": {
                  "id": "eth1/1"
                }
              }
            }
          ]
        }
      }
    ]
  }
}
{
    imdata:[]
}
  <intf-items>
    <aggr-items>
      <AggrIf-list>
        <id>po10</id>
        <isExplicit>false</isExplicit>
        <pcMode>on</pcMode>
        <rsmbrIfs-items>
          <RsMbrIfs-list>
            <tDn>/System/intf-items/phys-items/PhysIf-list[id='eth1/1']</tDn>
            <isMbrForce>true</isMbrForce>
          </RsMbrIfs-list>
        </rsmbrIfs-items>
      </AggrIf-list>
    </aggr-items>
    <phys-items>
      <PhysIf-list>
        <id>eth1/1</id>
      </PhysIf-list>
    </phys-items>
  </intf-items>


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

interface ethernet 1/1
 channel-group 10 force


Verifying a DME Configuration
The following table contains the distinguished name (DN) for each managed object (MO) in the DME payload. Issue a GET request using the DN to verify the configuration was posted or to get information about the configured properties of a particular object.

MODN
topSystem sys
interfaceEntity sys/intf
pcAggrIf sys/intf/aggr-{[id]}
pcRsMbrIfs sys/intf/aggr-{[id]}/rsmbrIfs-{[tDn]}
l1PhysIf sys/intf/phys-{[id]}


pcAggrIf Properties

The following table contains information about the pcAggrIf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
idnw:IfId
(base:IfIndex)
An identifier .Must match first field in the output of show intf brief. Example: Eth1/1 or Vlan100
isExplicitscalar:Bool
PC Created ExplicitlySELECTION: true or false
DEFAULT: true
pcModepc:Mode
(scalar:Enum8)
The aggregated interface protocol channel mode.SELECTION:
0 - on
1 - static
2 - active
3 - passive
4 - mac-pin
DEFAULT: on


pcRsMbrIfs Properties

The following table contains information about the pcRsMbrIfs properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
isMbrForcepc:ChnlGrpForce
(scalar:Bool)
Channel group forceSELECTION: true or false
tDn
reln:Dn
reference:BinRef
null


l1PhysIf Properties

The following table contains information about the l1PhysIf properties in the DME payload. For more information about the properties and MOs, see the NX-API DME Model Reference linked in the Related Documentation section below.

Property NameData TypeDescriptionValues
idnw:IfId
(base:IfIndex)
An identifier .Must match first field in the output of show intf brief. Example: Eth1/1 or Vlan100


Related Documentation

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference:

http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload:

https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide:

https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Disabling a Port-Channel Range

Disabling a Port-Channel Range
POST http://<mgmt0_IP>/api/mo/sys/intf.json
{
  "interfaceEntity": {
    "children": [
      {
        "pcAggrIf": {
          "attributes": {
            "adminSt": "down",
            "id": "po11",
            "userCfgdFlags": "admin_state"
}}},{
        "pcAggrIf": {
          "attributes": {
            "adminSt": "down",
            "id": "po10",
            "userCfgdFlags": "admin_state"
}}}]}}
{
    imdata:[]
}
<System>
  <intf-items>
    <aggr-items>
      <AggrIf-list>
        <id>po11</id>
        <adminSt>down</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
      <AggrIf-list>
        <id>po10</id>
        <adminSt>down</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
    </aggr-items>
  </intf-items>
</System>

Note: This example was added in Release 7.0(3)I7(2).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

interface port-channel 10-11
 shutdown

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Forcefully Disable a Port-Channel Range

Forcefully Disable a Port-Channel Range
POST http://<mgmt0_IP>/api/mo/sys/intf.json
{
  "interfaceEntity": {
    "children": [
      {
        "pcAggrIf": {
          "attributes": {
            "adminSt": "down",
            "id": "po11",
            "userCfgdFlags": "admin_state"
}}},{
        "pcAggrIf": {
          "attributes": {
            "adminSt": "down",
            "id": "po10",
            "userCfgdFlags": "admin_state"
}}}]}}
{
    imdata:[]
}
<System>
  <intf-items>
    <aggr-items>
      <AggrIf-list>
        <id>po11</id>
        <adminSt>down</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
      <AggrIf-list>
        <id>po10</id>
        <adminSt>down</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
    </aggr-items>
  </intf-items>
</System>

Note: This example was added in Release 7.0(3)I7(2).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

interface port-channel 10-11
 shutdown force

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Restarting a Disabled Port-Channel Range

Restarting a Disabled Port-Channel Range
POST http://<mgmt0_IP>/api/mo/sys/intf.json
{
  "interfaceEntity": {
    "children": [
      {
        "pcAggrIf": {
          "attributes": {
            "adminSt": "up",
            "id": "po11",
            "userCfgdFlags": "admin_state"
}}},{
        "pcAggrIf": {
          "attributes": {
            "adminSt": "up",
            "id": "po10",
            "userCfgdFlags": "admin_state"
}}}]}}
{
    imdata:[]
}
<System>
  <intf-items>
    <aggr-items>
      <AggrIf-list>
        <id>po11</id>
        <adminSt>up</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
      <AggrIf-list>
        <id>po10</id>
        <adminSt>up</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
    </aggr-items>
  </intf-items>
</System>

Note: This example was added in Release 7.0(3)I7(2).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

interface port-channel 10-11
 no shutdown

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html

Restarting a Forcefully Disabled Port-Channel Range

Restarting a Forcefully Disabled Port-Channel Range
POST http://<mgmt0_IP>/api/mo/sys/intf.json
{
  "interfaceEntity": {
    "children": [
      {
        "pcAggrIf": {
          "attributes": {
            "adminSt": "up",
            "id": "po11",
            "userCfgdFlags": "admin_state"
}}},{
        "pcAggrIf": {
          "attributes": {
            "adminSt": "up",
            "id": "po10",
            "userCfgdFlags": "admin_state"
}}}]}}
{
    imdata:[]
}
<System>
  <intf-items>
    <aggr-items>
      <AggrIf-list>
        <id>po11</id>
        <adminSt>up</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
      <AggrIf-list>
        <id>po10</id>
        <adminSt>up</adminSt>
        <userCfgdFlags>admin_state</userCfgdFlags>
      </AggrIf-list>
    </aggr-items>
  </intf-items>
</System>

Note: This example was added in Release 7.0(3)I7(2).


CLI Commands

The CLI commands are equivalent to the payload examples displayed in the pane on the right. Click the DME tab in the top-left corner of the right pane to view the JSON payload. Click the YANG tab to view the XML payload.

interface port-channel 10-11
 no shutdown force

For other CLI options, see the Cisco Nexus 9000 Series NX-OS Command Reference: http://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-command-reference-list.html

See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/

For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html