cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
252
Views
2
Helpful
1
Replies

disable IGMP snooping for some vlan in YDK

hamedfazelit
Level 1
Level 1

hi 

IGMP snooping is enable by default in 9200 switch. I want to disable it for some Vlan. I generated below code but get an error. 

can anybody help me how to do that?

 

 

 

vlansNoNeedsIGMP=[12,55]
    
    for vlan_id in vlansNoNeedsIGMP:
        vlanRange = Cisco_IOS_XE_native.Native.Ip.Igmp.SnoopingEntry.Snooping.Vlan.Range()
        vlanRange.range = vlan_id
        vlanRange.yfilter=YFilter.delete
        native_config.ip.igmp.snooping_entry.snooping.vlan.range.append(vlanRange)

 

 

 

2024-08-05 10:20:12,049 [ydk :102 ][ERROR   ][346462] RPC error occurred:
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>data-missing</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:ios-sw="http://cisco.com/ns/yang/Cisco-IOS-XE-switch" xmlns:ios-igmp="http://cisco.com/ns/yang/Cisco-IOS-XE-igmp" xmlns:ios="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:nc="urn:ietf:params:xml:ns:netconf:ba>
  </error-path>
    <error-info>
      <bad-element>range</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>    </error-info>
  </rpc-error>
</rpc-reply>

 

1 Accepted Solution

Accepted Solutions

hamedfazelit
Level 1
Level 1

The VLANs were not created, so attempting to delete them resulted in an error. The issue was resolved by replacing:

vlanRange.yfilter = YFilter.delete


with:

vlanRange.yfilter = YFilter.remove

In YFilter.remove, if the element does not exist, it will not generate an error.

View solution in original post

1 Reply 1

hamedfazelit
Level 1
Level 1

The VLANs were not created, so attempting to delete them resulted in an error. The issue was resolved by replacing:

vlanRange.yfilter = YFilter.delete


with:

vlanRange.yfilter = YFilter.remove

In YFilter.remove, if the element does not exist, it will not generate an error.