-
Notifications
You must be signed in to change notification settings - Fork 78
Delete operation fails on container #931
Copy link
Copy link
Closed
Description
Expected Behavior
crud.delete should allow you to delete a container in an element list.
Current Behavior
Execution fails with the following error:
2019-06-17 16:07:20,966 - ydk - INFO - Path where models are to be downloaded: /Users/deom/.ydk/domingo
2019-06-17 16:07:20,979 - ydk - INFO - Connected to domingo on port 830 using ssh with timeout of -1
2019-06-17 16:07:20,996 - ydk - INFO - Executing CRUD delete operation on [mpls]
2019-06-17 16:07:20,996 - ydk - INFO - Executing 'edit-config' RPC on [mpls]
Traceback (most recent call last):
File "./nc-delete-oc-mpls-20-ydk.py", line 89, in <module>
crud.delete(provider, network_instances.network_instance["default"].mpls)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 112, in helper
return func(self, provider, entity, *args, **kwargs)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/services/crud_service.py", line 105, in delete
return self._crud.delete(provider, entity)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
_raise(_exc)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 56, in _raise
raise exc
ydk.errors.YInvalidArgumentError: ancestor for entity cannot be nullptr as one of the ancestors is a list. Path: mpls
2019-06-17 16:07:21,003 - ydk - INFO - Disconnected from device
Your Script
from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider
from ydk.models.openconfig import openconfig_network_instance \
as oc_network_instance
def config_mpls(network_instances):
"""Add config data to bgp object."""
# configure default network instance
network_instance = network_instances.NetworkInstance()
network_instance.name = "default"
network_instance.config.name = "default"
network_instances.network_instance.append(network_instance)
if __name__ == "__main__":
"""Execute main program."""
parser = ArgumentParser()
parser.add_argument("-v", "--verbose", help="print debugging messages",
action="store_true")
parser.add_argument("device",
help="NETCONF device (ssh://user:password@host:port)")
args = parser.parse_args()
device = urlparse(args.device)
# create NETCONF provider
provider = NetconfServiceProvider(address=device.hostname,
port=device.port,
username=device.username,
password=device.password,
protocol=device.scheme)
# create CRUD service
crud = CRUDService()
# BGP configuration
network_instances = oc_network_instance.NetworkInstances()
config_mpls(network_instances) # add object configuration
# create configuration on NETCONF device
crud.delete(provider, network_instances.network_instance["default"].mpls)
Logs
Enable logging and post the logs below
2019-06-17 16:07:20,966 - ydk - INFO - Path where models are to be downloaded: /Users/deom/.ydk/domingo
2019-06-17 16:07:20,979 - ydk - INFO - Connected to domingo on port 830 using ssh with timeout of -1
2019-06-17 16:07:20,996 - ydk - INFO - Executing CRUD delete operation on [mpls]
2019-06-17 16:07:20,996 - ydk - INFO - Executing 'edit-config' RPC on [mpls]
Traceback (most recent call last):
File "./nc-delete-oc-mpls-20-ydk.py", line 89, in <module>
crud.delete(provider, network_instances.network_instance["default"].mpls)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 112, in helper
return func(self, provider, entity, *args, **kwargs)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/services/crud_service.py", line 105, in delete
return self._crud.delete(provider, entity)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
_raise(_exc)
File "/Users/deom/v/lib/python2.7/site-packages/ydk/errors/error_handler.py", line 56, in _raise
raise exc
ydk.errors.YInvalidArgumentError: ancestor for entity cannot be nullptr as one of the ancestors is a list. Path: mpls
2019-06-17 16:07:21,003 - ydk - INFO - Disconnected from device
System Information
ydk 0.8.3
ydk-models-cisco-ios-xr 6.6.2
ydk-models-ietf 0.1.5.post2
ydk-models-openconfig 0.1.7
ydk-service-gnmi 0.4.0.post2
Reactions are currently unavailable