Querying DHCP Relay Interfaces

Querying DHCP Relay Interfaces
GET http://<IP_Address>/api/mo/sys/dhcp/inst/relayif-[eth1/1].json?rsp-subtree=full 
{
    "totalCount": "1",
    "imdata": [
        {
            "dhcpRelayIf": {
                "attributes": {
                    "InformationTrustedEnabled": "no",
                    "SmartRelayEnabled": "no",
                    "SubnetBroadcastEnabled": "no",
                    "adminSt": "enabled",
                    "childAction": "",
                    "descr": "",
                    "dn": "sys/dhcp/inst/relayif-[eth1/1]",
                    "id": "eth1/1",
                    "modTs": "2018-07-06T20:44:48.559+00:00",
                    "monPolDn": "",
                    "name": "",
                    "options": "",
                    "persistentOnReload": "true",
                    "status": "",
                    "uid": "0"
                },
                "children": [
                    {
                        "dhcpRelayAddr": {
                            "attributes": {
                                "address": "1.1.1.2",
                                "childAction": "",
                                "counter": "2",
                                "gw": "0.0.0.0",
                                "modTs": "2018-07-06T20:44:48.559+00:00",
                                "mode": "not-visible",
                                "persistentOnReload": "true",
                                "rn": "addr-[!unspecified]-[1.1.1.2]",
                                "status": "",
                                "uid": "0",
                                "vrf": "!unspecified"
                            }
                        }
                    }
                ]
            }
        }
    ]
}
GET http://<IP_Address>/api/mo/sys/dhcp/inst/relayif-[vlan10].json?rsp-subtree=full 
{
    "totalCount": "1",
    "imdata": [
        {
            "dhcpRelayIf": {
                "attributes": {
                    "InformationTrustedEnabled": "no",
                    "SmartRelayEnabled": "no",
                    "SubnetBroadcastEnabled": "no",
                    "adminSt": "enabled",
                    "childAction": "",
                    "descr": "",
                    "dn": "sys/dhcp/inst/relayif-[vlan10]",
                    "id": "vlan10",
                    "modTs": "2018-07-06T20:49:30.427+00:00",
                    "monPolDn": "",
                    "name": "",
                    "options": "",
                    "persistentOnReload": "true",
                    "status": "",
                    "uid": "0"
                },
                "children": [
                    {
                        "dhcpRelayAddr": {
                            "attributes": {
                                "address": "2.2.2.2",
                                "childAction": "",
                                "counter": "2",
                                "gw": "0.0.0.0",
                                "modTs": "2018-07-06T20:49:30.427+00:00",
                                "mode": "not-visible",
                                "persistentOnReload": "true",
                                "rn": "addr-[!unspecified]-[2.2.2.2]",
                                "status": "",
                                "uid": "0",
                                "vrf": "!unspecified"
                            }
                        }
                    }
                ]
            }
        }
    ]
}
GET http:/<IP_Address>/restconf/data/Cisco-NX-OS-device:System/dhcp-items/inst-items/relayif-items
<relayif-items>
    <RelayIf-list>
        <id>eth1/1</id>
        <InformationTrustedEnabled>false</InformationTrustedEnabled>
        <SmartRelayEnabled>false</SmartRelayEnabled>
        <SubnetBroadcastEnabled>false</SubnetBroadcastEnabled>
        <addr-items>
            <RelayAddr-list>
                <vrf>!unspecified</vrf>
                <address>1.1.1.2</address>
                <counter>2</counter>
                <mode>not-visible</mode>
            </RelayAddr-list>
        </addr-items>
        <adminSt>enabled</adminSt>
    </RelayIf-list>
    <RelayIf-list>
        <id>vlan10</id>
        <InformationTrustedEnabled>false</InformationTrustedEnabled>
        <SmartRelayEnabled>false</SmartRelayEnabled>
        <SubnetBroadcastEnabled>false</SubnetBroadcastEnabled>
        <addr-items>
            <RelayAddr-list>
                <vrf>!unspecified</vrf>
                <address>2.2.2.2</address>
                <counter>2</counter>
                <mode>not-visible</mode>
            </RelayAddr-list>
        </addr-items>
        <adminSt>enabled</adminSt>
    </RelayIf-list>
</relayif-items>

Note: This example was added in Cisco NX-OS Release 9.2(1).

CLI Output
switch(config-if)# show ip dhcp relay address interface e1/1
Interface        Relay Address     VRF Name
-------------    -------------     --------
Ethernet1/1       1.1.1.2


switch(config-if)# sh ip dhcp relay address interface vlan 10
Interface        Relay Address     VRF Name
-------------    -------------     --------
Vlan10            2.2.2.2


Note: The property information for this example was added in Release 9.3(3).


dhcpRelayIf Properties

The following table contains information about the dhcpRelayIf 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
InformationTrustedEnabledscalar:Bool
Information Trusted EnabledSELECTION: true or false
SmartRelayEnabledscalar:Bool
Smart Relay EnabledSELECTION: true or false
SubnetBroadcastEnabledscalar:Bool
Subnet Broadcast EnabledSELECTION: true or false
adminStnw:IfAdminSt
(nw:AdminSt)
The administrative state of the object or policy.SELECTION:
1 - enabled
2 - disabled
childAction
mo:ModificationChildAction
scalar:Bitmask32
Delete or ignore. For internal use only.SELECTION:
  • 16384u - deleteAll
  • 4096u - ignore
  • 8192u - deleteNonPresent
  • DEFAULT: 0
  • descr
    naming:Descr1024
    string:Basic
    Additional descriptive information about the object. RANGE: Min: "0" Max: "1024"
    dn
    reference:BinRef
    A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module.
    idnw:IfId
    (base:IfIndex)
    An identifier .Must match first field in the output of `show intf brief`. Example: Eth1/1 or Vlan100
    modTsmo:TStamp
    (scalar:Date)
    The time when this object was last modified.SELECTION:
    0 - never
    DEFAULT: never
    monPolDn
    reference:BinRef
    The monitoring policy attached to this observable object.
    name
    naming:Name256
    string:Basic
    The name of the object. RANGE: Min: "0" Max: "128"
    optionsdhcp:Options
    (scalar:Bitmask64)
    DHCP optionsSELECTION:
    0 - none
    1 - relay-info
    DEFAULT: none
    persistentOnReload
    mo:Persistent
    scalar:Enum8
    NO COMMENTSSELECTION:
  • 0 - false
  • 1 - true
  • DEFAULT: true(1)
  • statusmo:ModificationStatus
    (scalar:Bitmask32)
    The upgrade status. This property is for internal use only.SELECTION:
    2 - created
    4 - modified
    8 - deleted
    16 - replaced
    uid
    scalar:Uint16
    A unique identifier for this object.


    dhcpRelayAddr Properties

    The following table contains information about the dhcpRelayAddr 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
    addressaddress:Ip
    Discovered IP address: switch will pick one address in case of dhcp client Configured relay address: multiple ip addresses as configured by the user FIXME IFC to give generic ip addressValue must match ipv4 or ipv6 known format
    childAction
    mo:ModificationChildAction
    scalar:Bitmask32
    Delete or ignore. For internal use only.SELECTION:
  • 16384u - deleteAll
  • 4096u - ignore
  • 8192u - deleteNonPresent
  • DEFAULT: 0
  • counterscalar:Uint16
    CounterRANGE: [0, 65535]
    gw
    address:Ip
    Gateway IP address, valid only when we are crossing vrfs. Should always be present when client is crossing vrf to get its ip address
    modTsmo:TStamp
    (scalar:Date)
    The time when this object was last modified.SELECTION:
    0 - never
    DEFAULT: never
    mode
    dhcp:RelayVisibility
    scalar:Enum8
    The BGP Domain mode.SELECTION:
  • 0 - visible
  • 1 - not-visible
  • DEFAULT: not-visible(1)
  • persistentOnReload
    mo:Persistent
    scalar:Enum8
    NO COMMENTSSELECTION:
  • 0 - false
  • 1 - true
  • DEFAULT: true(1)
  • rn
    reference:BinRN
    Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names.
    statusmo:ModificationStatus
    (scalar:Bitmask32)
    The upgrade status. This property is for internal use only.SELECTION:
    2 - created
    4 - modified
    8 - deleted
    16 - replaced
    uid
    scalar:Uint16
    A unique identifier for this object.
    vrfl3:VrfName
    (string:Basic)
    vrf in which the dhcp server is present. Valid only when the client is in a different vrf from the server vrfA sequence of characters


    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