Configuring VRRP

The NX-API REST API supports the REST-based configuration of the Virtual Router Redundancy Protocol (VRRP), versions 2 (VRRPv2) and 3 (VRRPv3), on the Cisco Nexus 3000 and 9000 Series devices. VRRPv2 only supports IPv4 addresses, whereas VRRPv3 supports both IPv4 and IPv6 addresses.

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

Note: VRRPv3 is not supported on the Cisco Nexus 3500 Platform.

VRRPv2

By default, when VRRPv2 is enabled on the device, a MO calls /sys/vrrp/inst/ is created. This is a VRRPv2 configuration instance. As you create VRRP IDs, additional objects are created under the /sys/vrrp/inst/ object.

Enabling VRRPv2

Enabling VRRPv2
POST http://<IP_Address>/api/mo/sys/fm/vrrp.json
{
  "fmEntity": {
    "children": [
      {
        "fmVrrp": {
          "attributes": {
            "adminSt": "enabled"
}}}]}}
{
    imdata:[]
}
<System>
  <fm-items>
    <vrrp-items>
      <adminSt>enabled</adminSt>
    </vrrp-items>
  </fm-items>
</System>


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

feature vrrp

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 VRRPv2

Disabling VRRPv2
POST http://<IP_Address>/api/mo/sys/fm/vrrp.json
{
  "fmEntity": {
    "children": [
      {
        "fmVrrp": {
          "attributes": {
            "adminSt": "disabled"
}}}]}}
{
    imdata:[]
}
<System>
  <fm-items>
    <vrrp-items>
      <adminSt>disabled</adminSt>
    </vrrp-items>
  </fm-items>
</System>


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

no feature vrrp

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 a VRRPv2 Interface

Creating a VRRPv2 Interface
POST http://<IP_Address>/api/mo/sys/fm/vrrp.json
{
  "vrrpInst": {
    "children": [
      {
        "vrrpInterface": {
          "attributes": {
            "id": "eth1/7"
          },
          "children": [
            {
              "vrrpId": {
                "attributes": {
                  "id": "123"
}}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrp-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Id-list>
              <id>123</id>
              <adminSt>enabled</adminSt>
            </Id-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrp-items>
</System>


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

interface ethernet 1/7
 vrrp 123

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 a Primary VRRPv2 ID

Creating a Primary VRRPv2 ID
POST http://<IP_address>/api/mo/sys/vrrp/inst.json
{
  "vrrpInst": {
    "children": [
      {
        "vrrpInterface": {
          "attributes": {
            "id": "eth1/7"
          },
          "children": [
            {
              "vrrpId": {
                "attributes": {
                  "adminSt": "enabled",
                  "id": "123",
                  "primary": "1.2.3.4"
}}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrp-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Id-list>
              <id>123</id>
              <primary>1.2.3.4</primary>
            </Id-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrp-items>
</System>

The HTTP request shown in this example creates a Managed Object called with an ID of 123 and a primary IP address of 1.2.3.4.


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

interface ethernet 1/7
 vrrp 123
 &nbsp;address 1.2.3.4`

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 a Secondary VRRPv2 ID

Creating a Secondary VRRPv2 ID
POST http://<IP_address>/api/mo/sys/vrrp/inst.json
{
  "vrrpInst": {
    "children": [
      {
        "vrrpInterface": {
          "attributes": {
            "id": "eth1/7"
          },
          "children": [
            {
              "vrrpId": {
                "attributes": {
                  "id": "123"
                },
                "children": [
                  {
                    "vrrpSecondary": {
                      "attributes": {
                        "secondary": "4.3.2.1"
}}}]}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrp-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Id-list>
              <id>123</id>
              <secondary-items>
                <Secondary-list>
                  <secondary>4.3.2.1</secondary>
                </Secondary-list>
              </secondary-items>
            </Id-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrp-items>
</System>

The HTTP request in this example creates a secondary VRRPv2 ID named 4.3.2.1 under the primary VRRP ID 123.


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

interface ethernet 1/7
 vrrp 123
 &nbsp;address 4.3.2.1 secondary`

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

VRRPv3

By default, when VRRPv3 is enabled on the device, a MO calls /sys/vrrpv3/inst/ is created. This is a VRRPv3 configuration instance. As you create VRRPv3 IDs, additional objects are created under the /sys/vrrpv3/inst/ object.

Enabling VRRPv3

Enabling VRRPv3
POST http://<IP_Address>/api/mo/sys/fm/vrrp.json
{
  "fmEntity": {
    "children": [
      {
        "fmVrrpv3": {
          "attributes": {
            "adminSt": "enabled"
}}}]}}
{
    imdata:[]
}
<System>
  <fm-items>
    <vrrpv3-items>
      <adminSt>enabled</adminSt>
    </vrrpv3-items>
  </fm-items>
</System>

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


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

feature vrrpv3

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 VRRPv3

Disabling VRRPv3
POST http://<IP_Address>/api/mo/sys/fm/vrrp.json
{
  "fmEntity": {
    "children": [
      {
        "fmVrrpv3": {
          "attributes": {
            "adminSt": "disabled"
}}}]}}
{
    imdata:[]
}
<System>
  <fm-items>
    <vrrpv3-items>
      <adminSt>disabled</adminSt>
    </vrrpv3-items>
  </fm-items>
</System>

Note: This example was added in Release 7.0(3)I6(1).


CLI Command

The CLI command below is the equivalent to the payload example 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 or the YANG tab to view the XML payload.

no feature vrrpv3

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 a VRRPv3 Interface

Creating a VRRPv3 Interface
POST http://<ip_address>/api/mo/sys/vrrpv3/inst.json
{
 "vrrpv3Inst": {
    "children": [
      {
        "vrrpv3Interface": {
          "attributes": {
            "id": "eth1/7"
          },
          "children": [
            {
              "vrrpv3Vr": {
                "attributes": {
                  "af": "ipv4",
                  "id": "10"
}}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrpv3-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Vr-list>
              <id>10</id>
              <af>ipv4</af>
            </Vr-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrpv3-items>
</System>

The HTTP request shown in this example creates a VRRPv3 instance with a group ID of 10 and an IPv4 address family.


CLI Commands

The CLI commands and options 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 or the YANG tab to view the XML payload.

interface ethernet1/7
 vrrpv3 10 address-family ipv4

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

Generating a VRRPv3 Interface

Generating a VRRPv3 Interface
POST http://<ip_address>/api/mo/sys/vrrpv3/inst.json
{
  "topSystem": {
    "children": [
      {
        "vrrpv3Entity": {
          "children": [
            {
              "vrrpv3Inst": {
                "children": [
                  {
                    "vrrpv3Interface": {
                      "attributes": {
                        "id": "eth1/7"
                      },
                      "children": [
                        {
                          "vrrpv3Vr": {
                            "attributes": {
                              "af": "ipv6",
                              "id": "123"      
}}}]}}]}}]}},{
        "interfaceEntity": {
          "children": [
            {
              "l1PhysIf": {
                "attributes": {
                  "id": "eth1/7",
                  "layer": "Layer3",
                  "userCfgdFlags": "admin_layer"
}}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrpv3-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Vr-list>
              <id>123</id>
              <af>ipv6</af>
            </Vr-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrpv3-items>
  <intf-items>
    <phys-items>
      <PhysIf-list>
        <id>eth1/7</id>
        <layer>Layer3</layer>
        <userCfgdFlags>admin_layer</userCfgdFlags>
      </PhysIf-list>
    </phys-items>
  </intf-items>
</System>


CLI Commands

The CLI commands and options 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 or the YANG tab to view the XML payload.

interface ethernet1/7
 no switchport
  vrrpv3 123 address-family ipv6

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 a Primary VRRP ID and Address Family

Creating a Primary VRRP ID and Address Family
POST http://<IP_address>/api/mo/sys/vrrpv3/inst.json
{
 "vrrpv3Interface": {
    "attributes": {
      "id": "eth1/7"
    },
    "children": [
      {
        "vrrpv3Vr": {
          "attributes": {
            "af": "ipv4",
            "id": "10",
            "ip": "100.0.1.10"
}}}]}}
{
    imdata:[]
}
<System>
  <vrrpv3-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/7</id>
          <id-items>
            <Vr-list>
              <id>10</id>
              <af>ipv4</af>
              <ip>100.0.1.10</ip>
            </Vr-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrpv3-items>
</System>

The HTTP request shown in this example creates a Managed Object called "vrrpv3Vr" with an address family attribute (af) of ipv4, an address family ID of "10", and an IP address of 10.10.10.102.


CLI Commands

The CLI commands and options 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 or the YANG tab to view the XML payload.

interface ethernet1/7
 vrrpv3 10 address-family ipv4
  address 100.0.1.10 primary

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

Configuring VRRPv3 Control Group for IPv6

Configuring VRRPv3 for IPv6
POST http://<mgmt0_IP>/api/mo/sys/vrrpv3/inst.json
{
"vrrpv3Inst": {
 "children": [
  {
    "vrrpv3Interface": {
      "attributes": {
        "id": "eth1/1"
},
"children": [
{
  "vrrpv3Vr": {
    "attributes": {
      "af": "ipv6",
      "id": "1",
      "ip": "fe80::1",
      "preempt": "disabled",
      "priCfg": "120"
},
"children": [
  {
    "vrrpv3Addr": {
      "attributes": {
        "addr": "1::5"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::2"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::8"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::3"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::7"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::6"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1::4"
}}}]}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrpv3-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/1</id>
          <id-items>
            <Vr-list>
              <id>1</id>
              <af>ipv6</af>
              <ip>fe80::1</ip>
              <preempt>disabled</preempt>
              <priCfg>120</priCfg>
              <addr-items>
                <Addr-list>
                  <addr>1::5</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::2</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::8</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::3</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::7</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::6</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1::4</addr>
                </Addr-list>
              </addr-items>
            </Vr-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrpv3-items>
</System>

When configuring a VRRPv3 control group for IPv6, the IP in the payload must be a LINK-Local address. For VRRPv3 IPv6 configurations, link local is the primary address. So global unicast addresses must be the secondary addresses (child MOs).

Note: Secondary IP address support was added from Release 7.0(3)I6(1) where as primary IP and vrrpv3 REST configs are supported from Release 7.0(3)I5(1).


CLI Commands

The CLI commands and options listed below are the 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 or the YANG tab to view the XML payload.

interface ethernet1/1
 vrrpv3 1 address-family ipv6
  priority 120
  no preempt
  address fe80::1 primary
  address 1::2
  address 1::3
  address 1::4
  address 1::5
  address 1::6
  address 1::7
  address 1::8

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

Configuring VRRPv3 Control Group for IPv4

Configuring VRRPv3 for IPv4
POST http://<mgmt0_IP>/api/mo/sys/vrrpv3/inst.json
{
  "vrrpv3Inst": {
    "children": [
      {
        "vrrpv3Interface": {
          "attributes": {
            "id": "eth1/1"
},
"children": [
{
  "vrrpv3Vr": {
    "attributes": {
      "advIntvl": "1100",
      "af": "ipv4",
      "id": "1",
      "ip": "1.1.1.2",
      "preempt": "enabled",
      "preemptDelayMin": "10",
      "priCfg": "150"
},
"children": [
  {
    "vrrpv3Addr": {
      "attributes": {
        "addr": "1.1.1.8"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.3"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.7"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.9"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.4"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.5"
}}},{
"vrrpv3Addr": {
  "attributes": {
    "addr": "1.1.1.6"
}}}]}}]}}]}}
{
    imdata:[]
}
<System>
  <vrrpv3-items>
    <inst-items>
      <if-items>
        <Interface-list>
          <id>eth1/1</id>
          <id-items>
            <Vr-list>
              <id>1</id>
              <af>ipv4</af>
              <advIntvl>1100</advIntvl>
              <ip>1.1.1.2</ip>
              <preempt>enabled</preempt>
              <preemptDelayMin>10</preemptDelayMin>
              <priCfg>150</priCfg>
              <addr-items>
                <Addr-list>
                  <addr>1.1.1.8</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.3</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.7</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.9</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.4</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.5</addr>
                </Addr-list>
                <Addr-list>
                  <addr>1.1.1.6</addr>
                </Addr-list>
              </addr-items>
            </Vr-list>
          </id-items>
        </Interface-list>
      </if-items>
    </inst-items>
  </vrrpv3-items>
</System>

Configures a VRRPv3 control group for IPv4.

Note: This example was added in Release 7.0(3)I6(1).


CLI Commands

The CLI commands and options listed below are the 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 or the YANG tab to view the XML payload.

interface ethernet1/1
 vrrpv3 1 address-family ipv4
  timers advertise 1100
  priority 150
   preempt delay minimum 10
   address 1.1.1.2 primary
   address 1.1.1.3 secondary
   address 1.1.1.4 secondary
   address 1.1.1.5 secondary
   address 1.1.1.6 secondary
   address 1.1.1.7 secondary
   address 1.1.1.8 secondary
   address 1.1.1.9 secondary

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/](https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/