I'm unable to figure out the restconf URI needed to GET the configured VLAN for a given switchport interface for IOS-XE.

I would also like to be able to UPDATE a switchport-access VLAN given a port.

I've looked at the below modules but havent had any luck

  • Cisco-IOS-XE-vlan.yang/Cisco-IOS-XE-vlan-oper.yang - this module appears to provide interface data given the VLAN ID
  • Cisco-IOS-XE-native.yang
  • Cisco-IOS-XE-interfaces.yang - the "groupting interface-switchport-grouping" looked promising, but it appears to be for settting up config, NOT GETTING config
  • Cisco-IOS-XE-interfaces-oper.yang

I also tried searching through https://yangcatalog.org/yang-search without much luck there either.

Is there a way to get the configured switchport-access-vlan for a given port using Cisco-IOS-XE yang models ? If yes, what would the restconf URI be ? If not, is there a workaround ?

For a potential workaround, i'm thinking I could use the vlan-related module to get all vlan memberships, then loop through the membership list and look for the desired interface.

Also, what would the URI and request body look like for a RESTCONF api call to update a switchport access vlan, given a port ?

  • Have you checked out cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/… ?
    – Zac67
    Nov 5 '21 at 14:46
  • @Zac67 Thanks for the doc. After reading through it though, I dont believe it will solve my problem because it appears that the API is not available for CAT 3850 devices. I should have specified platform in question. So I went ahead and updated the question title.
    – jlrivera81
    Nov 5 '21 at 19:59
  • Found GET https://switch/restconf/data/Cisco-IOS-XE-vlan-oper:vlans/vlan here. ;-)
    – Zac67
    Nov 5 '21 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.