Table 1. SPAN/RSPAN APIs
Action
|
Method
|
Payload Required
|
API
|
To add source vlan to SPAN session
|
PATCH
|
Yes
|
/api/config/switch/monitor
|
To replace existing vlan with current source vlan to SPAN session
|
PUT
|
Yes
|
/api/config/switch/monitor
|
To delete source vlan in a SPAN session
|
DELETE
|
No
|
/api/config/switch/monitor/session/\"1\"/source/vlan
|
To delete source interface in a SPAN session
|
DELETE
|
No
|
/api/config/switch/monitor/session/\"1\"/source/interfaces/gigabitEthernet/\"1\/0\"
|
To delete destination interface in a SPAN session
|
DELETE
|
No
|
/api/running/switch/monitor/session/\"2\"/destination
|
To delete source vlan to RSPAN session
|
DELETE
|
No
|
/api/config/switch/monitor/session/\"1\"/source/remote
|
To delete destination vlan and reflector-port to RSPAN session
|
DELETE
|
No
|
/api/config/switch/monitor
|
To show source session
|
GET
|
No
|
/api/running/switch/monitor/session/\"1\"/source
|
To show destination session
|
GET
|
No
|
/api/running/switch/monitor/session/\"4\"/destination
|
Example for SPAN/RSPAN APIs Payload
<monitor><session><session-id>1</session-id><source><vlan>5</vlan></source></session></monitor>
Example for SPAN/RSPAN APIs Payload
<monitor><session><session-id>1</session-id><source><interfaces><gigabitEthernet><name>1/0</name><direction>both</direction></gigabitEthernet></interfaces></source></session></monitor>
Example for SPAN/RSPAN APIs Payload
<monitor><session><session-id>1</session-id><source><remote><vlan>20</vlan></remote></source></session></monitor>
Example for SPAN/RSPAN APIs Payload
<monitor><session><session-id>4</session-id><destination><remote><vlan>20</vlan><reflector-port></reflector-port><gigabitEthernet>1/4</gigabitEthernet><network></network></remote></destination></session></monitor>
Example: PATCH SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>1</session-id><source><vlan>5</vlan></source></session></monitor>" -X PATCH https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: PUT SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>1</session-id><source><vlan>6</vlan></source></session></monitor>" -X PUT https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: PATCH SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>1</session-id><source><interfaces><gigabitEthernet><name>1/0</name><direction>both</direction></gigabitEthernet></interfaces></source></session></monitor>" -X PATCH https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: PATCH SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>1</session-id><source><interfaces><gigabitEthernet><name>1/1</name><direction>rx</direction></gigabitEthernet></interfaces></source></session></monitor>" -X PATCH https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: PATCH SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>1</session-id><source><remote><vlan>20</vlan></remote></source></session></monitor>" -X PATCH https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: PATCH SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<monitor><session><session-id>4</session-id><destination><remote><vlan>20</vlan><reflector-port></reflector-port><gigabitEthernet>1/4</gigabitEthernet><network></network></remote></destination></session></monitor>" -X PATCH https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: DELETE SPAN/RSPAN APIs
curl -k -v -u admin:admin -X DELETE https://209.165.201.1/api/config/switch/monitor/session/\"1\"/source/vlan -H "Content-Type: application/vnd.yang.data+xml"
Example: DELETE SPAN/RSPAN APIs
curl -k -v -u admin:admin -X DELETE https://209.165.201.1/api/config/switch/monitor/session/\"1\"/source/interfaces/gigabitEthernet/\"1\/0\"
Example: DELETE SPAN/RSPAN APIs
curl -k -v -u admin:admin -X DELETE https://172.25.212.189/api/running/switch/monitor/session/\"2\"/destination
Example: DELETE SPAN/RSPAN APIs
curl -k -v -u admin:admin -X DELETE https://209.165.201.1/api/config/switch/monitor/session/\"1\"/source/remote -H "Content-Type: application/vnd.yang.data+xml"
Example: DELETE SPAN/RSPAN APIs
curl -k -v -u admin:admin -d "<session><session-id>1</session-id><destination><remote><vlan>20</vlan><reflector-port></reflector-port><gigabitEthernet>1/4</gigabitEthernet><network></network></remote></destination></session>" -X DELETE https://209.165.201.1/api/config/switch/monitor -H "Content-Type: application/vnd.yang.data+xml"
Example: GET SPAN/RSPAN APIs
curl -k -v -u admin:admin -X GET https://209.165.201.1/api/running/switch/monitor/session/\"1\"/source
Example: GET SPAN/RSPAN APIs
curl -k -v -u admin:admin -X GET https://209.165.201.1/api/running/switch/monitor/session/\"4\"/destination