cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1050
Views
11
Helpful
4
Replies

Change operational state of vlan using restconf on 9500 platform

BradyPocock
Level 1
Level 1

I am trying to change the operational state of l2 vlans on a 9500 stack running 17.6.4 with restconf.

I can get the vlan: https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/vlan-list=580

{
   "Cisco-IOS-XE-vlan:vlan-list": {
     "id": 580,
     "name": "0580.SRM.TEST"
   }
}

I can successfully shutdown the vlan: https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list

patch body:
{
"Cisco-IOS-XE-vlan:vlan-list": [
{
"id": 580,
"name": "0580.SRM.TEST",
"shutdown": [
null
]
}
]
}

I am stuck changing the operational state back to active. The current workaround is to delete the vlan and recreate the vlan. Obviously not ideal.

YANG data model is new to me. Not sure how to delete the "shutdown" leaf of the vlan.

list vlan-list {
key "id";
leaf id {
description
"a single VLAN id (allowed value range 1-4094)or Comma-separated VLAN id range.e.g. 99 or 1-30 or 1-20,30,40-50";
type uint16 {
range "1..4094";
}
leaf state {
description
"Operational state of the VLAN";
type enumeration {
enum "active";
enum "suspend";
}
}
leaf shutdown {
description
"Shutdown VLAN switching";
type empty;
}
}

I currently accomplish this on NX-OS with the following but this datacenter is migrating off the 93180 platform to the 9500.

{
"ins_api": {
"version": "1.0",
"type": "cli_conf",
"chunk": "0",
"sid": "1",
"input": "vlan 580 ;no shutdown",
"output_format": "json"
}
}

If anybody has experience with this, I would be greatfull.

 

1 Accepted Solution

Accepted Solutions

Marcel Zehnder
Spotlight
Spotlight

Hi

I don't have access to a RESTCONF enabled switch at the moment, but deleting the shutdown leaf for vlan 580 should just work like this:

DELETE  https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=580/shutdown

HTH
Marcel

View solution in original post

4 Replies 4

Marcel Zehnder
Spotlight
Spotlight

Hi

I don't have access to a RESTCONF enabled switch at the moment, but deleting the shutdown leaf for vlan 580 should just work like this:

DELETE  https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=580/shutdown

HTH
Marcel

Thank you so much. I was also able to verify that it works. Really appreciate your guidance on this!

Marcel Zehnder
Spotlight
Spotlight

@BradyPocock I was able to test this on a Cat9k and can confirm that my answer above is correct:

Disable vlan switching (vlan-580):
PATCH https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=580

 

{
    "Cisco-IOS-XE-vlan:vlan-list": {
        "shutdown": [null]
    }
}

 

 

Activate vlan switching (vlan 580):
DELETE https://<ip>/restconf/data/Cisco-IOS-XE-native:native/vlan/Cisco-IOS-XE-vlan:vlan-list=580/shutdown 
(no payload/content)

Marcel

 

You're an angel