Published On: August 6ᵗʰ, 2019 02:12

API Reference for Cisco Enterprise Network Function Virtualization Infrastructure Software

Table 1. Interface GigabitEthernet Switchport APIs

Action

Method

Payload Required

API

To retrieve interface switchport configuration

GET

No

/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport

To configure interface switchport mode

PATCH

Yes

/api/running/switch/interface/gigabitEthernet

To replace interface switchport trunk allowed vlans for interface

PUT

Yes

/api/config/switch/interface/gigabitEthernet/\"1/0\"

To delete interface switchport protected-port

DELETE

No

/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/protected-port

To delete interface switchport mode

DELETE

No

/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/mode

To delete interface switchport trunk allowed vlan

DELETE

No

/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/trunk/allowed/vlan/

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><mode>trunk</mode></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><trunk><native><vlan>100</vlan></native></trunk></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><trunk><allowed><vlan><ids>502</ids><ids>503</ids></vlan></allowed></trunk></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><community>1</community></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><dot1q-tunnel><vlan>100</vlan></dot1q-tunnel></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><access><vlan>2</vlan></access></switchport></gigabitEthernet>

Example for Interface GigabitEthernet Switchport APIs Payload

<gigabitEthernet><name>1/0</name><switchport><protected-port></protected-port></switchport></gigabitEthernet>

Example: GET Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -X GET https://209.165.201.1/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><mode>trunk</mode></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><trunk><native><vlan>100</vlan></native></trunk></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><trunk><allowed><vlan><ids>502</ids><ids>503</ids></vlan></allowed></trunk></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PUT Interface GigabitEthernet Switchport APIs

curl -k -v -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><trunk><allowed><vlan><ids>52</ids><ids>507</ids></vlan></allowed></trunk></switchport></gigabitEthernet>" -X  PUT  https://209.165.201.1/api/config/switch/interface/gigabitEthernet/\"1/0\" -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><community>1</community></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><dot1q-tunnel><vlan>100</vlan></dot1q-tunnel></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><access><vlan>2</vlan></access></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: PATCH Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -d "<gigabitEthernet><name>1/0</name><switchport><protected-port></protected-port></switchport></gigabitEthernet>" -X PATCH https://209.165.201.1/api/running/switch/interface/gigabitEthernet -H "Content-Type: application/vnd.yang.data+xml"

Example: DELETE Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -X DELETE https://209.165.201.1/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/protected-port

Example: DELETE Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -X DELETE https://209.165.201.1/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/mode

Example: DELETE Interface GigabitEthernet Switchport APIs

curl -k -u admin:admin -X DELETE https://209.165.201.1/api/running/switch/interface/gigabitEthernet/\"1/0\"/switchport/trunk/allowed/vlan/