- Is there any possibility to send multiple entities (objects) in a single netconf create requests. It may be not possible directly with CRUD but any ways that we could do this with the netconf service method.
- The idea is to not create multiple sessions with the router for sending different objects (e.g. BGP, ISIS etc.)
Are you trying to avoid multiple transactions or do you really mean sessions? The NetconfServiceProvider session you create is already reused across multiple requests.
- yeah its actually multiple transactions and not sessions.
suggest you try something like:
from ydk.services import NetconfService
from ydk.services import Datastore
from ydk.providers import NetconfServiceProvider
from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ifmgr_cfg as ifmgr_cfg
# still need the service provider
session = NetconfServiceProvider(
address='22.214.171.124', # TODO insert your IP
# Initialize a NetconfService, rather than a CRUDService
nc = NetconfService()
# try creating a number of loopbacks in multiple edit-config operations
for index in xrange(100, 105):
cr_lo = ifmgr_cfg.InterfaceConfigurations.InterfaceConfiguration()
cr_lo.interface_virtual = Empty()
cr_lo.interface_name = 'Loopback%d' % index
cr_lo.description = 'Created Lo%d' % index
cr_lo.active = 'act'
cr_intf_configs = ifmgr_cfg.InterfaceConfigurations()
# now commit all the changes
Did a quick example of multiple interfaces added separately. You may call edit_config multiple times with objects from different places in the overall platform data model.
- How does NetconfService handle transactions across multiple devices so that if a commit for a single device fails, it does not commit for the rest of the devices. Guessing this is something to do on top of ydk-py (possibly via return code) and not inside ydk-py.
Correct, the YDK-Py doesn't coordinate transactions across devices. That is outside its current scope. If all the devices you are coordinating across support confirmed-commit, it is fairly simple to do a 2-phase-like sequence.
Note that the example above has multiple operations (RPCs) in a single transaction using NetconfService. With the CRUDService, each create operation is a transaction. If you're interested in sending data for multiple models in a single operation, take a look at these issue and give them a +1: