cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
856
Views
0
Helpful
7
Replies

gNMI provider support for delete/replace filters on non root entities

aasrani
Cisco Employee
Cisco Employee

Hi, 

I have compiled models of version 7.3.1 16I in ENV (Python 3.6.7, YDK 0.8.4, Pyang 1.6)

But we are facing issues while providing replace/delete with gnmi service for non root entities :-

https://github.com/CiscoDevNet/ydk-gen/issues/885

 

ACL :-

{"openconfig-acl:acl":{"acl-sets":{"acl-set":[{"name":"config001","type":"ACL_IPV4","config":{"name":"config001","type":"ACL_IPV4"},"acl-entries":{"acl-entry":[{"@":{"ietf-netconf:operation":"delete"},"sequence-id":1}]}}]}}}

Debug---:ydk:

{"openconfig-acl:acl":{"acl-sets":{"acl-set":[{"name":"config001","type":"ACL_IPV4","config":{"name":"config001","type":"ACL_IPV4"},"acl-entries":{"acl-entry":[{"@":{"ietf-netconf:operation":"delete"},"sequence-id":1}]}}]}}}

2020-08-04 17:02:44,320 - ydk - Info---- -

=============== Set Request Sent ================

update {

  path {

    origin: "openconfig-acl"

    elem {

      name: "acl"

    }

  }

  val {

    json_ietf_val: "{\"acl-sets\":{\"acl-set\":[{\"name\":\"config001\",\"type\":\"ACL_IPV4\",\"config\":{\"name\":\"config001\",\"type\":\"ACL_IPV4\"},\"acl-entries\":{\"acl-entry\":[{\"@\":{\"ietf-netconf:operation\":\"delete\"},\"sequence-id\":1}]}}]}}"

  }

}

 

 

2020-08-04 17:02:44,320 - ydk - Info---- -

=============== Set Request Sent ================

update {

  path {

    origin: "openconfig-acl"

    elem {

      name: "acl"

    }

  }

  val {

    json_ietf_val: "{\"acl-sets\":{\"acl-set\":[{\"name\":\"config001\",\"type\":\"ACL_IPV4\",\"config\":{\"name\":\"config001\",\"type\":\"ACL_IPV4\"},\"acl-entries\":{\"acl-entry\":[{\"@\":{\"ietf-netconf:operation\":\"delete\"},\"sequence-id\":1}]}}]}}"

  }

}

 

 

 

=============== Set Request Sent ================

update {

  path {

    origin: "openconfig-acl"

    elem {

      name: "acl"

    }

  }

  val {

    json_ietf_val: "{\"acl-sets\":{\"acl-set\":[{\"name\":\"config001\",\"type\":\"ACL_IPV4\",\"config\":{\"name\":\"config001\",\"type\":\"ACL_IPV4\"},\"acl-entries\":{\"acl-entry\":[{\"@\":{\"ietf-netconf:operation\":\"delete\"},\"sequence-id\":1}]}}]}}"

  }

}

 

 

Info----:ydk:

=============== Set Request Sent ================

update {

  path {

    origin: "openconfig-acl"

    elem {

      name: "acl"

    }

  }

  val {

    json_ietf_val: "{\"acl-sets\":{\"acl-set\":[{\"name\":\"config001\",\"type\":\"ACL_IPV4\",\"config\":{\"name\":\"config001\",\"type\":\"ACL_IPV4\"},\"acl-entries\":{\"acl-entry\":[{\"@\":{\"ietf-netconf:operation\":\"delete\"},\"sequence-id\":1}]}}]}}"

  }

}

 

 

2020-08-04 17:02:44,369 - ydk - Error--- - SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Unknown element is specified: openconfig-acl:acl/acl-sets/acl-set[name = 'config001' and type = 'ACL_IPV4']/acl-entries/acl-entry[sequence-id = '1']/: @

2020-08-04 17:02:44,369 - ydk - Error--- - SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Unknown element is specified: openconfig-acl:acl/acl-sets/acl-set[name = 'config001' and type = 'ACL_IPV4']/acl-entries/acl-entry[sequence-id = '1']/: @

SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Unknown element is specified: openconfig-acl:acl/acl-sets/acl-set[name = 'config001' and type = 'ACL_IPV4']/acl-entries/acl-entry[sequence-id = '1']/: @

Error---:ydk:SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Unknown element is specified: openconfig-acl:acl/acl-sets/acl-set[name = 'config001' and type = 'ACL_IPV4']/acl-entries/acl-entry[sequence-id = '1']/: @

*** ydk.errors.YServiceProviderError:  SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Unknown element is specified: openconfig-acl:acl/acl-sets/acl-set[name = 'config001' and type = 'ACL_IPV4']/acl-entries/acl-entry[sequence-id = '1']/: @

 

Question 1 :- Is there any solution for this issue in the latest ydk 0.8.4 ?

 

Question 2 :- Is there any other workaround to achieve similar delete/replace equivalent for non root entities ?

 

Thanks

Anmol Asrani

7 Replies 7

yangorelik
Spotlight
Spotlight

Hi Anmol

Your set requests do not look correct. I am not sure how you could create them with YDK. Could you please attach the actual Python script and log files.

Yan Gorelik
YDK Solutions

Hi Yan,

Thanks for the reponse!!

Here, I am using gNMIServiceProvider to establish gNMI connection and trying to delete the leaf with the help of YFilter delete option as below,

 

import os

from ydk.path import Repository

from ydk.gnmi.providers import gNMIServiceProvider

repository=Repository(“/ws/kmathiya-bgl/yang”)

 

repository=Repository("/ws/kmathiya-bgl/yang")

provider=gNMIServiceProvider(repo=repository,address="5.38.4.153",port=57400,username="cafyauto",password="cisco123")

from ydk.services import CRUDService

crud = CRUDService()

from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ethernet_lldp_cfg

lldp=Cisco_IOS_XR_ethernet_lldp_cfg.Lldp()

lldp.enable=True

lldp.enable_subintf=True

from ydk.filters import YFilter

crud.read(provider,lldp)

import logging

logger = logging.getLogger("ydk")

logger.setLevel(logging.INFO)

handler = logging.StreamHandler()

formatter = logging.Formatter(("%(asctime)s - %(name)s - %(levelname)s - %(message)s"))

handler.setFormatter(formatter)

logger.addHandler(handler)

crud.read(provider,lldp)

2020-08-04 17:29:53,926 - ydk - INFO - Executing CRUD read operation on [Cisco-IOS-XR-ethernet-lldp-cfg:lldp]

2020-08-04 17:29:53,929 - ydk - INFO -

=============== Get Request Sent ================

path {

  origin: "Cisco-IOS-XR-ethernet-lldp-cfg"

  elem {

    name: "lldp"

  }

}

encoding: JSON_IETF

 

 

2020-08-04 17:29:53,941 - ydk - INFO -

============= Get Response Received =============

notification {

  timestamp: 1596542394431436959

  update {

    path {

      origin: "Cisco-IOS-XR-ethernet-lldp-cfg"

      elem {

        name: "lldp"

      }

    }

    val {

      json_ietf_val: "{\"enable\":true,\"enable-subintf\":true}"

    }

  }

}

error {

}

 

2020-08-04 17:29:53,942 - ydk - INFO - Get Operation Succeeded

<ydk.models.cisco_ios_xr.Cisco_IOS_XR_ethernet_lldp_cfg.Lldp object at 0x2b8a6a5101a8>

>>>

>>> lldp.enable_subintf=YFilter.delete

>>> crud.create(provider,lldp)

2020-08-04 17:30:15,569 - ydk - INFO - Executing CRUD create operation on [Cisco-IOS-XR-ethernet-lldp-cfg:lldp]

2020-08-04 17:30:15,570 - ydk - INFO - Executing set gRPC operation 'update' on entity 'Cisco-IOS-XR-ethernet-lldp-cfg:lldp'

2020-08-04 17:30:15,575 - ydk - INFO -

=============== Set Request Sent ================

update {

  path {

    origin: "Cisco-IOS-XR-ethernet-lldp-cfg"

    elem {

      name: "lldp"

    }

  }

  val {

    json_ietf_val: "{\"enable-subintf\":true,\"@enable-subintf\":{\"ietf-netconf:operation\":\"delete\"},\"enable\":true}"

  }

}

 

 

2020-08-04 17:30:15,611 - ydk - ERROR - SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Cisco-IOS-XR-ethernet-lldp-cfg:lldp/@enable-subintf: @enable-subintf

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/auto/tftp-access-ops/kmat/release/20.07.03/rhel7-20.07.03/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 112, in helper

    return func(self, provider, entity, *args, **kwargs)

  File "/auto/tftp-access-ops/kmat/release/20.07.03/rhel7-20.07.03/lib/python3.6/site-packages/ydk/services/crud_service.py", line 49, in create

    return _crud_update(provider, entity, self._crud.create)

  File "/auto/tftp-access-ops/kmat/release/20.07.03/rhel7-20.07.03/lib/python3.6/site-packages/ydk/services/crud_service.py", line 70, in _crud_update

   return crud_call(provider, entity)

  File "/usr/cisco/packages/python/python-3.6.7/lib/python3.6/contextlib.py", line 99, in __exit__

    self.gen.throw(type, value, traceback)

  File "/auto/tftp-access-ops/kmat/release/20.07.03/rhel7-20.07.03/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error

    _raise(_exc)

  File "/auto/tftp-access-ops/kmat/release/20.07.03/rhel7-20.07.03/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise

    exec("raise exc from None")

  File "<string>", line 1, in <module>

ydk.errors.YServiceProviderError:  SetRequest failed with error:

gNMI: set-request update/replace: unknown-element: Cisco-IOS-XR-ethernet-lldp-cfg:lldp/@enable-subintf: @enable-subintf

 

I see there is an open git issue for the same :- https://github.com/CiscoDevNet/ydk-gen/issues/885

 

 Thanks,

Anmol

Hi Anmol

When you need delete configuration you should call crud.delete:

>>>
>>> lldp.enable_subintf=YFilter.delete
>>> crud.delete(provider, lldp)
Yan Gorelik
YDK Solutions

Hi Yan,
My requirement is to delete specific leaf “enable_subintf” which is configured under lldp container.
RP/0/RP0/CPU0:AP-R2#sh run lldp
Wed Aug 5 10:10:27.779 IST
lldp
subinterfaces enable
!
But crud.delete delete’s entire lldp configuration as below,
>>> lldp.enable_subintf=YFilter.delete
>>> crud.delete(provider, lldp)
RP/0/RP0/CPU0:AP-R2#sh run lldp
Wed Aug 5 10:14:12.536 IST
% No such configuration item(s)

The delete request should not remove the whole tree when you specify path for a leaf, unless that leaf was the only set data element on that tree. The Protobuf 0.4.0 definition specifies the following:

// SetRequest is sent from a client to the target to update values in the data
// tree. Paths are either deleted by the client, or modified by means of being
// updated, or replaced. Where a replace is used, unspecified values are
// considered to be replaced, whereas when update is used the changes are
// considered to be incremental. The set of changes that are specified within
// a single SetRequest are considered to be a transaction.
// Reference: gNMI Specification Section 3.4.1
message SetRequest {
Path prefix = 1; // Prefix used for paths in the message.
repeated Path delete = 2; // Paths to be deleted from the data tree.
repeated Update replace = 3; // Updates specifying elements to be replaced.
repeated Update update = 4; // Updates specifying elements to updated.
}

If you have multiple data nodes on the tree with list elements or set leaf values and delete operation for single leaf removes the whole tree, that would indicate a bug in the gNMI server implementation on the IOS XR.

In order to make this determination, could you please run crud.read_config() before the delete operation and record GetRequest and GetResponse messages; then run delete operation and record SetRequest message. It would be more clear to have the whole log file or console printout with enabled INFO logging level. 

Yan Gorelik
YDK Solutions

Hi Yan,

As suggested by you, I am using gnmiService(classydk.gnmi.services.gNMIService) to delete for gnmi requests.

1) However I am facing issue with deleting a leaf of datatype 'str' :-

 

RP/0/RP0/CPU0:POD-TN3#sh run telemetry model-driven
Mon Aug 17 13:07:45.734 UTC
telemetry model-driven
sensor-group test_config_invmgr_sensor_group_name
!
sensor-group test_config_optics_sensor_group_name
!
!

 

I want to delete this sensor group with group-id 'test_config_invmgr_sensor_group_name':-

 

>>>from ydk.models.cisco_ios_xr import openconfig_telemetry as oc_mdt

>>> config_grp_id = oc_mdt.TelemetrySystem.SensorGroups.SensorGroup()

>>> config_grp_id.sensor_group_id = sensor_group_id

>>> config_grp_id.config.sensor_group_id = sensor_group_id

>>> sensor_group_id

'test_config_invmgr_sensor_group_name'

>>> config_grp_id.yfilter=YFilter.delete

>>> lldp_read=gnmi.set(provider,config_grp_id)

2020-08-17 18:06:50,937 - ydk - DEBUG - Executing get gRPC for single entity

2020-08-17 18:06:50,938 - ydk - INFO - Executing set gRPC operation 'delete' on entity 'sensor-group[sensor-group-id='test_config_invmgr_sensor_group_name']'

2020-08-17 18:06:50,938 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-group". Count: 1

2020-08-17 18:06:50,938 - ydk.types.Entity - DEBUG - Leaf data name: "sensor-group-id", value: "test_config_invmgr_sensor_group_name", yfilter: "YFilter.not_set", is_set: "True"

2020-08-17 18:06:50,938 - ydk - DEBUG - parse_entity_prefix: Entity path: 'openconfig-telemetry:telemetry-system/sensor-groups/sensor-group[sensor-group-id='test_config_invmgr_sensor_group_name']'

2020-08-17 18:06:50,938 - ydk - DEBUG - parse_prefix_to_path: Got data node path prefix: 'openconfig-telemetry:telemetry-system'

2020-08-17 18:06:50,938 - ydk - DEBUG - gnmi_util::add_path_elem: Adding elem: 'telemetry-system'

2020-08-17 18:06:50,938 - ydk - DEBUG - gnmi_util::add_path_elem: Adding elem: 'sensor-groups'

2020-08-17 18:06:50,939 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-group". Count: 1

2020-08-17 18:06:50,939 - ydk.types.Entity - DEBUG - Leaf data name: "sensor-group-id", value: "test_config_invmgr_sensor_group_name", yfilter: "YFilter.not_set", is_set: "True"

2020-08-17 18:06:50,939 - ydk - DEBUG - gnmi_util::parse_entity: Adding elem: 'sensor-group'

2020-08-17 18:06:50,939 - ydk - DEBUG - gnmi_util::parse_entity: Adding key value: 'sensor-group-id:test_config_invmgr_sensor_group_name'

2020-08-17 18:06:50,939 - ydk - DEBUG -

2020-08-17 18:06:50,939 - ydk.types.Entity - DEBUG - Get name leaf data for "config". Count: 1

2020-08-17 18:06:50,939 - ydk.types.Entity - DEBUG - Leaf data name: "sensor-group-id", value: "test_config_invmgr_sensor_group_name", yfilter: "YFilter.not_set", is_set: "True"

2020-08-17 18:06:50,939 - ydk - DEBUG - gnmi_util::parse_entity_children: Looking at child 'config': 'config'

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Get name leaf data for "config". Count: 1

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Leaf data name: "sensor-group-id", value: "test_config_invmgr_sensor_group_name", yfilter: "YFilter.not_set", is_set: "True"

2020-08-17 18:06:50,940 - ydk - DEBUG - gnmi_util::parse_entity: Adding elem: 'config'

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Get name leaf data for "config". Count: 1

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Leaf data name: "sensor-group-id", value: "test_config_invmgr_sensor_group_name", yfilter: "YFilter.not_set", is_set: "True"

2020-08-17 18:06:50,940 - ydk - DEBUG -

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-paths". Count: 0

2020-08-17 18:06:50,940 - ydk - DEBUG - gnmi_util::parse_entity_children: Looking at child 'sensor_paths': 'sensor-paths'

2020-08-17 18:06:50,940 - ydk - DEBUG - Child has no data and no operations

2020-08-17 18:06:50,940 - ydk - DEBUG -

2020-08-17 18:06:50,940 - ydk.types.Entity - DEBUG - Get name leaf data for "state". Count: 0

2020-08-17 18:06:50,941 - ydk - DEBUG - gnmi_util::parse_entity_children: Looking at child 'state': 'state'

2020-08-17 18:06:50,941 - ydk - DEBUG - Child has no data and no operations

2020-08-17 18:06:50,941 - ydk - INFO -

=============== Set Request Sent ================

delete {

  origin: "openconfig-telemetry"

  elem {

    name: "telemetry-system"

  }

  elem {

    name: "sensor-groups"

  }

  elem {

    name: "sensor-group"

    key {

      key: "sensor-group-id"

      value: "test_config_invmgr_sensor_group_name"

    }

  }

  elem {

    name: "config"

  }

}

 

 

2020-08-17 18:06:50,948 - ydk - ERROR - SetRequest failed with error:

gNMI: set-request delete: unknown-element: Request is not wellformed: invalid character 'e' in literal true (expecting 'r')

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "/auto/tftp-access-ops/kmat/release/PY367_Y84/rhel7-PY367_Y84/lib/python3.6/site-packages/ydk/gnmi/services/gnmi_service.py", line 72, in set

    result = self._gs.set(provider, entities)

  File "/usr/cisco/packages/python/python-3.6.7/lib/python3.6/contextlib.py", line 99, in __exit__

    self.gen.throw(type, value, traceback)

  File "/auto/tftp-access-ops/kmat/release/PY367_Y84/rhel7-PY367_Y84/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error

    _raise(_exc)

  File "/auto/tftp-access-ops/kmat/release/PY367_Y84/rhel7-PY367_Y84/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise

    exec("raise exc from None")

  File "<string>", line 1, in <module>

ydk.errors.YServiceProviderError:  SetRequest failed with error:

gNMI: set-request delete: unknown-element: Request is not wellformed: invalid character 'e' in literal true (expecting 'r')

 

2) However when I try to perform delete on container level, its working :-

Deleting sensor-groups level:

>>> config_grp_id = oc_mdt.TelemetrySystem.SensorGroups()

>>> config_grp_id.yfilter=YFilter.delete

>>> lldp_read=gnmi.set(provider,config_grp_id)

2020-08-17 18:22:35,395 - ydk - DEBUG - Executing get gRPC for single entity

2020-08-17 18:22:35,395 - ydk - INFO - Executing set gRPC operation 'delete' on entity 'sensor-groups'

2020-08-17 18:22:35,395 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-groups". Count: 0

2020-08-17 18:22:35,395 - ydk - DEBUG - parse_entity_prefix: Entity path: 'openconfig-telemetry:telemetry-system/sensor-groups'

2020-08-17 18:22:35,395 - ydk - DEBUG - parse_prefix_to_path: Got data node path prefix: 'openconfig-telemetry:telemetry-system'

2020-08-17 18:22:35,395 - ydk - DEBUG - gnmi_util::add_path_elem: Adding elem: 'telemetry-system'

2020-08-17 18:22:35,396 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-groups". Count: 0

2020-08-17 18:22:35,396 - ydk - DEBUG - gnmi_util::parse_entity: Adding elem: 'sensor-groups'

2020-08-17 18:22:35,396 - ydk.types.Entity - DEBUG - Get name leaf data for "sensor-groups". Count: 0

2020-08-17 18:22:35,396 - ydk - INFO -

=============== Set Request Sent ================

delete {

  origin: "openconfig-telemetry"

  elem {

    name: "telemetry-system"

  }

  elem {

    name: "sensor-groups"

  }

}

 

 

2020-08-17 18:22:36,202 - ydk - INFO -

============= Set Response Received =============

response {

  path {

    origin: "openconfig-telemetry"

    elem {

      name: "telemetry-system"

    }

    elem {

      name: "sensor-groups"

    }

  }

  message {

  }

  op: DELETE

}

message {

}

timestamp: 1597668422505593523

 

 

2020-08-17 18:22:36,202 - ydk - INFO - Set Operation Succeeded

>>> 

 

3)I am able to delete leaf of type 'boolean':-

 

RP/0/RP0/CPU0:POD-TN3#sh run lldp
Mon Aug 17 13:13:14.385 UTC
lldp
subinterfaces enable
!

 

>>> from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ethernet_lldp_cfg as xr_ethernet_lldp_cfg
>>>
>>> lldp=xr_ethernet_lldp_cfg.Lldp()
>>> lldp.enable=True
>>> lldp.enable_subintf=True

>>>lldp.enable_subintf = YFilter.delete

>>> lldp.yfilter=YFilter.delete
>>> lldp_read=gnmi.set(provider,lldp)

 

2020-08-17 14:37:11,640 - ydk - DEBUG - Executing get gRPC for single entity
2020-08-17 14:37:11,641 - ydk - INFO - Executing set gRPC operation 'delete' on entity 'Cisco-IOS-XR-ethernet-lldp-cfg:lldp'
2020-08-17 14:37:11,641 - ydk.types.Entity - DEBUG - YFilter assigned to "enable_subintf", "YFilter.delete"
2020-08-17 14:37:11,641 - ydk.types.Entity - DEBUG - Get name leaf data for "lldp". Count: 2
2020-08-17 14:37:11,641 - ydk.types.Entity - DEBUG - Leaf data name: "enable-subintf", value: "false", yfilter: "YFilter.delete", is_set: "True"
2020-08-17 14:37:11,642 - ydk.types.Entity - DEBUG - Leaf data name: "enable", value: "true", yfilter: "YFilter.not_set", is_set: "True"
2020-08-17 14:37:11,642 - ydk - DEBUG - parse_entity_prefix: Entity path: 'Cisco-IOS-XR-ethernet-lldp-cfg:lldp'
2020-08-17 14:37:11,642 - ydk - DEBUG - parse_prefix_to_path: Got data node path prefix: 'Cisco-IOS-XR-ethernet-lldp-cfg:lldp'
2020-08-17 14:37:11,642 - ydk - DEBUG - gnmi_util::add_path_elem: Adding elem: 'lldp'
2020-08-17 14:37:11,642 - ydk.types.Entity - DEBUG - YFilter assigned to "enable_subintf", "YFilter.delete"
2020-08-17 14:37:11,643 - ydk.types.Entity - DEBUG - Get name leaf data for "lldp". Count: 2
2020-08-17 14:37:11,643 - ydk.types.Entity - DEBUG - Leaf data name: "enable-subintf", value: "false", yfilter: "YFilter.delete", is_set: "True"
2020-08-17 14:37:11,643 - ydk.types.Entity - DEBUG - Leaf data name: "enable", value: "true", yfilter: "YFilter.not_set", is_set: "True"
2020-08-17 14:37:11,643 - ydk - DEBUG - gnmi_util::parse_entity_children: Adding elem for YLeaf: 'enable-subintf'
2020-08-17 14:37:11,643 - ydk - INFO -
=============== Set Request Sent ================
delete {
origin: "Cisco-IOS-XR-ethernet-lldp-cfg"
elem {
name: "lldp"
}
elem {
name: "enable-subintf"
}
}


2020-08-17 14:37:12,452 - ydk - INFO -
============= Set Response Received =============
response {
path {
origin: "Cisco-IOS-XR-ethernet-lldp-cfg"
elem {
name: "lldp"
}
elem {
name: "enable-subintf"
}
}
message {
}
op: DELETE
}
message {
}
timestamp: 1597654898772004192

 

RP/0/RP0/CPU0:POD-TN3#sh run lldp
Mon Aug 17 13:12:44.195 UTC
lldp
!

 

Can you please check and provide solution to delete leaf with datatype string ?

 

Thanks

Anmol Asrani

It is possible that there is a bug in the YDK code - the yfilter setting on non-top level entity is not transferred to the top level entity. When using gNMIService you should always set operation defining yfilter to top level entity. Try this:

from ydk.models.cisco_ios_xr import openconfig_telemetry as oc_mdt

telemetry_system = oc_mdt.TelemetrySystem()
sensor_group = oc_mdt.TelemetrySystem.SensorGroups.SensorGroup()
sensor_group.sensor_group_id = "test_config_invmgr_sensor_group_name"
telemetry_system.sensor_groups.sensor_group.append(sensor_group)
telemetry_system.yfilter = YFilter.delete
gnmi = gNMIService()
result = gnmi.set(provider, telemetry_system)

Note that default set operation for gNMIService is update. The replace and delete operations must be set explicitly with corresponding yfilter on top level entity.

Yan Gorelik
YDK Solutions
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: