cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
390
Views
0
Helpful
1
Replies
benicetomeok
Beginner

print entire interface XML from CRUDService, crud.read.

This seems like this should be an easy one... but, I am unable to print the entire XML using the variables I've just created....

Is the original xml included in the 'interface_configuration' variable below?  I'm not discovering it in the dictionary.

If I'm going about dumping the interface wrong, how do I do it using this or similar modules?

I have figured out how to print individual values from the interface_configuration, like interface-name.

What I mean is this....

from ydk.services import CRUDService

from ydk.providers import NetconfServiceProvider

from ydk.models.cisco_ios_xr import Cisco_IOS_XR_ifmgr_cfg as xr_ifmgr_cfg

provider = NetconfServiceProvider(address="abc.123.com",

                                      port=830,

                                      username="me",

                                      password="password",

                                      protocol="ssh")

crud = CRUDService()

interface_configurations = xr_ifmgr_cfg.InterfaceConfigurations()

interface_configuration = crud.read(provider, interface_configurations)

## Now how do print the XML

print  what???

provider.close()
exit()

The print should be the massive <interface-configurations> xml tree.

Similar to: (not all shown)

<interface-configurations xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ifmgr-cfg">
  <interface-configuration>
    <active>pre</active>
    <interface-name>POS0/4/0/0</interface-name>
    <description>CORE OC48 to po0/1/0/0-abc.123</description>
    <cdp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-cdp-cfg">
      <enable/>
    </cdp>
    <mtus>
      <mtu>
        <owner>pos</owner>
        <mtu>4567</mtu>
      </mtu>
    </mtus>
    <ipv4-network xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-ipv4-io-cfg">
      <addresses>
        <primary>
          <address>123.456.789.000</address>
          <netmask>255.255.255.252</netmask>

... and all the rest of the interfaces...

Thanks for any help you can give on this.

1 ACCEPTED SOLUTION

Accepted Solutions
saalvare
Cisco Employee

1 REPLY 1
saalvare
Cisco Employee

Create
Recognize Your Peers
Content for Community-Ad