QuestionQ546

Network Fundamentals

Refer to the exhibit. Drag the code snippets into the code blanks to enable keepalive for the FastEthernet 2/0 interface. Not every option is used.

Question Image

Drag & Drop
interface_data = crud.update(provider, interface)
interface.keepalive = True
interface_data = crud.read(provider, interface)
interface = model.Native.Interface.FastEthernet()
interface.FastEthernet.keepalive_settings.keepalive = True
interface = model.Native.Interface()
from ydk.services import CRUDService
from ydk.providers import NetconfServiceProvider as nc
from ydk.models.cisco_ios_xe import Cisco_IOS_XE_native as model
ip = '10.10.20.48'
prtcl = 'ssh'
user = 'developer'
psw = 'P@$$w0rD'
port = 830
provider = nc(address=ip, port=port, username=user, password=psw, protocol=prtcl)
crud = CRUDService()

interface.name = '2/0'


if interface_data:
    print('Keepalive is enabled.')
else:
    print('Keepalive is not enabled.')
Explanation

FastEthernet is the interface entity that contains the name key and Boolean keepalive configuration leaf. Setting the name to 2/0, assigning True to keepalive, and using CRUDService.update applies the configuration through the NETCONF provider.

Community Discussion

No comments yet. Be the first to start the discussion!