Skip to main content
REST API reference
A newer release of this product is available.

ONTAP REST API Network ethernet switches endpoints

Overview

This API can be used to get information about the ethernet switches used for cluster and/or storage networks. This API support GET and PATCH calls. The GET operation returns a list of discovered switches with status and configuration information. The PATCH can be used to modify state of the switch.

Examples

Retrieving the ethernet switches for a cluster

The following example retrieves the ONTAP switches from the cluster. Note that if the fields=* parameter is not specified, the fields snmp.version, snmp.credential, model, sw-version, reason, version-source, monitoring.enable, monitoring.subsystem.type and monitoring.subsystem.poll_interval are not returned. Filters can be added on the fields to limit the results.

# The API:
GET network/ethernet/switches

# The call:
curl -X GET "https://<mgmt-ip>/api/network/ethernet/switches?return_records=true" -H  "accept: application/json" -H "Content-Type: application/hal+json"

# The response:
{
"records": [
  {
    "name": "RTP-CS01-510R11(FOC22092K12)",
    "address": "172.26.207.77",
    "discovered": true,
    "model": "NX3232C",
    "monitoring": {
      "monitored": true,
      "reason": "None"
    },
    "network": "cluster",
    "serial_number": "Unknown",
    "snmp": {
    "version": "snmpv2c",
    "user": "cshm1!"
  },
    "version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.2(3)",
    "_links": {
      "self": {
        "href": "/api/network/ethernet/switches/RTP-CS01-510R11%28FOC22092K12%29"
      }
    }
  },
  {
    "name": "RTP-CS01-510R12(FOC22373C3P)",
    "address": "172.26.207.82",
    "discovered": true,
    "model": "NX3232C",
    "monitoring": {
      "monitored": true,
      "reason": "None"
    },
    "network": "cluster",
    "serial_number": "FOC22373C3P",
    "snmp": {
      "version": "snmpv2c",
      "user": "cshm1!"
    },
    "version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.2(3)",
    "_links": {
      "self": {
        "href": "/api/network/ethernet/switches/RTP-CS01-510R12%28FOC22373C3P%29"
      }
    }
  },          {
    "name": "RTP-SS01-510R10(FOC22170DFR)",
    "address": "172.26.207.65",
    "discovered": true,
    "model": "NX3232C",
    "monitoring": {
      "monitored": true,
      "reason": "None"
    },
    "network": "storage",
    "serial_number": "FOC22170DFR",
    "snmp": {
      "version": "snmpv2c",
      "user": "cshm1!"
    },
    "version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.3(3)",
    "_links": {
      "self": {
        "href": "/api/network/ethernet/switches/RTP-SS01-510R10%28FOC22170DFR%29"
      }
    }
  },
  {
    "name": "RTP-SS02-510R10(FOC22131U6T)",
    "address": "172.26.207.66",
    "discovered": true,
    "model": "NX3232C",
    "monitoring": {
      "monitored": true,
      "reason": "None"
    },
    "network": "storage",
    "serial_number": "FOC22131U6T",
    "snmp": {
      "version": "snmpv2c",
      "user": "cshm1!"
    },
    "version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.3(3)",
    "_links": {
      "self": {
        "href": "/api/network/ethernet/switches/RTP-SS02-510R10%28FOC22131U6T%29"
      }
    }
  }
],
"num_records": 4,
"_links": {
  "self": {
    "href": "/api/network/ethernet/switches?fields=*&return_records=true"
  }
}
}

Retrieving an ethernet switch for a cluster

The following example retrieves a single switch by the switchname using the API.

# The API:
GET /network/ethernet/switches{name}

# The call:
curl -X GET "https://<mgmt-ip>/api/network/ethernet/switches/RTP-SS02-510R10(FOC22131U6T?return_records=true" -H  "accept: application/json" -H "Content-Type: application/hal+json"

# The response:
{
"name": "RTP-SS02-510R10(FOC22131U6T)",
"address": "172.26.207.66",
"discovered": true,
"model": "NX3232C",
"monitoring": {
  "monitored": true,
  "reason": "None"
},
"network": "storage",
"serial_number": "FOC22131U6T",
"snmp": {
  "version": "snmpv2c",
  "user": "cshm1!"
},
"version": "Cisco Nexus Operating System (NX-OS) Software, Version 9.3(3)",
"_links": {
  "self": {
    "href": "/api/network/ethernet/switches/RTP-SS02-510R10(FOC22131U6T)"
  }
}
}

Configuring a switch

The following example configures SNMP credential and version on a switch.

# The API:
PATCH /network/ethernet/switches{name}

# The call:
curl -X PATCH "https://<mgmt-ip>/api/network/ethernet/switches/sconqa-corduroyl-03" -H "accept: application/json" -H "Content-Type: application/hal+json" -d "{ \"snmp\": { \"version\": \"snmpv2c\", \"user\": \"cshm1!\"}}"

# The response:
{}