Open Kani999 opened 2 years ago
https://github.com/napalm-automation/napalm/blob/develop/napalm/pyIOSXR/iosxr.py#L409 https://github.com/napalm-automation/napalm/blob/develop/napalm/pyIOSXR/iosxr.py#L415
def _execute_rpc(self, command_xml, delay_factor=0.1):
xml_rpc_command = (
'<?xml version="1.0" encoding="UTF-8"?><Request MajorVersion="1" MinorVersion="0">'
+ command_xml
+ "</Request>"
)
response = self._send_command(xml_rpc_command, delay_factor=delay_factor)
xml_rpc_command =
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Operational>
<SystemTime/>
<PlatformInventory>
<RackTable>
<Rack>
<Naming>
<Name>0</Name>
</Naming>
<Attributes>
<BasicInfo/>
</Attributes>
</Rack>
</RackTable>
</PlatformInventory>
</Operational>
</Get>
</Request>
response =
<?xml version="1.0" encoding="UTF-8"?>\n
<Response MajorVersion="1" MinorVersion="0">
<Get ErrorCode="0x43679000" ErrorMsg="'XML Service Library' detected the 'warning' condition 'An error was encountered in the XML beneath this operation tag'">
<Operational>
<SystemTime MajorVersion="4" MinorVersion="2">
<Clock>
<Year>2022</Year>
<Month>5</Month>
<Day>30</Day>
<Hour>13</Hour>
<Minute>20</Minute>
<Second>24</Second>
<Millisecond>619</Millisecond>
<Wday>1</Wday>
<TimeZone>CEST</TimeZone>
<TimeSource>NTP</TimeSource>
</Clock>
<Uptime>
<Hostname>HOSTNAME</Hostname>
<Uptime>97348</Uptime>
</Uptime>
</SystemTime>
<PlatformInventory ErrorCode="0x4368a400" ErrorMsg="'XMLMDA' detected the 'warning' condition 'The XML request does not conform to the schema. No such element name exists at this location in the schema. Please check the request against the schema.'"/>
</Operational>
</Get>
<ResultSummary ErrorCount="1"/>
</Response>
So PlatformInventory
doesn't exist on 7.3.3? Is there an alternate place we should be querying for this information on 7.3.3?
@ktbyers Could you help me with how I can get the whole XML representation from the device? So I can look at what's in there when PlatfomrInventory
is missing?
Instead of PlatformInventory
there is Inventory
with Entities
instead RackTable
xml request:
<?xml version="1.0" encoding="UTF-8"?>
<Request MajorVersion="1" MinorVersion="0">
<Get>
<Operational>
<SystemTime/>
<Inventory>
<Entities>
<Entity>
<Naming>
<Name>Rack 0</Name>
</Naming>
<Attributes>
<InvBasicBag></InvBasicBag>
</Attributes>
</Entity>
</Entities>
</Inventory>
</Operational>
</Get>
</Request>
response:
<?xml version="1.0" encoding="UTF-8"?>
<Response MajorVersion="1" MinorVersion="0">
<Get>
<Operational>
<SystemTime MajorVersion="4" MinorVersion="2">
<Clock><Year>2022</Year><Month>6</Month><Day>3</Day><Hour>12</Hour><Minute>29</Minute><Second>39</Second><Millisecond>64</Millisecond><Wday>5</Wday><TimeZone>CEST</TimeZone><TimeSource>NTP</TimeSource></Clock>
<Uptime>
<Hostname>HOSTNAME</Hostname>
<Uptime>439903</Uptime>
</Uptime>
</SystemTime>
<Inventory MajorVersion="6" MinorVersion="0">
<Entities MajorVersion="6" MinorVersion="0">
<Entity>
<Naming><Name>Rack 0</Name></Naming>
<Attributes>
<InvBasicBag>
<Description>Cisco 8201 Chassis w/ 24x400GE QSFP56-DD&12x100GE QSFP28</Description>
<VendorType>1.3.6.1.4.1.9.12.3.1.3.2044</VendorType>
<Name>Rack 0</Name>
<HardwareRevision>V03</HardwareRevision>
<SoftwareRevision>7.3.3</SoftwareRevision>
<ChipHardwareRevision>1.0</ChipHardwareRevision>
<SerialNumber>FOCXXXXXN051</SerialNumber>
<ModelName>8201</ModelName>
<assetIdStr>N/A</assetIdStr>
<IsFieldReplaceableUnit>true</IsFieldReplaceableUnit>
<CompositeClassCode>65536</CompositeClassCode>
<Alias>N/A</Alias>
<UnrecognizedFRU>false</UnrecognizedFRU>
<UniqueID>8384555</UniqueID>
</InvBasicBag>
</Attributes>
</Entity>
</Entities>
</Inventory>
</Operational>
</Get>
<ResultSummary ErrorCount="0"/>
</Response>
@ktbyers I've created pull request (work in progress) #1664 which replaces the XML RPC calls which work with iosxr
version 7.3.3
.
It fixes get_facts
and get_interfaces
calls. I did not test other methods, but I suppose there will be problems too.
But I don't know how to make conditional statements that determine which xml_rpc_command
(and xpaths) should be executed based on the version
of the platform. Do you know how to handle this if you only get the version information in the get_facts
method?
@Kani999 We could detect the OS-version on connect (NAPALM open()
call) and then set that as a private object attribute.
napalm_object._iosxr_version()
We would have to use a solution for detecting the OS version that we thought would reasonably work across versions and if it fails set it to unknown
and then in the getters have some default action happen for the unknown
case.
Does that sound reasonable?
@ktbyers - That sounds fine, but still, I don't know which "common" command should be sent to the device, to get the os_version
response in the open()
method.
Sending CLI command show version
and parse it? (Using textfsm or something).
@Kani999 Yes, someone will have to dig into the IOS-XR netconf and which "get" operations would reliably return this across some set of IOS-XR versions.
@Kani999 Okay, I think with what you provided above there is probably enough...let me see what I can do on this.
I didn't do any work on this. Someone would still need to work on this.
Unable to get facts from IOS-XR (7.3.3) device
Did you follow the steps from https://github.com/napalm-automation/napalm#faq
Setup
napalm version
Network operating system version
Steps to Reproduce the Issue
run
napalm --user USERNAME --password PASSWORD --vendor iosxr --debug IP_ADDRESS call get_facts
Error Traceback