def _xml_to_py(self, has_xml, has_py): PhyPortBase._xml_to_py(self, has_xml, has_py) Resource.copyifexists(has_xml, 'speed', has_py) Resource.copyifexists(has_xml, 'link-mode', has_py, 'duplex') if has_xml.find('gigether-options/loopback') is not None: has_py['loopback'] = True has_py['$unit_count'] = len(has_xml.findall('unit')) # normalizers if 'duplex' in has_py: PhyPortBase._set_invert(has_py, 'duplex', self.PORT_DUPLEX)
def _xml_to_py(self, has_xml, has_py): PhyPortBase._xml_to_py(self, has_xml, has_py) Resource.copyifexists(has_xml, "speed", has_py) Resource.copyifexists(has_xml, "link-mode", has_py, "duplex") if has_xml.find("gigether-options/loopback") is not None: has_py["loopback"] = True has_py["$unit_count"] = len(has_xml.findall("unit")) # normalizers if "duplex" in has_py: PhyPortBase._set_invert(has_py, "duplex", self.PORT_DUPLEX)
def _xml_to_py(self, has_xml, has_py): PhyPortBase._xml_to_py(self, has_xml, has_py) # speed, duplex, loopback are all under 'ether-options' ethopts = has_xml.find('ether-options') if ethopts is None: return if ethopts.find('loopback') is not None: has_py['loopback'] = True speed = ethopts.find('speed') if speed is not None: # take the first child element has_py['speed'] = speed[0].tag PhyPortBase._set_invert(has_py, 'speed', self.PORT_SPEED) Resource.copyifexists(ethopts, 'link-mode', has_py, 'duplex') if 'duplex' in has_py: PhyPortBase._set_invert(has_py, 'duplex', self.PORT_DUPLEX)
def _xml_to_py(self, has_xml, has_py): PhyPortBase._xml_to_py(self, has_xml, has_py) # speed, duplex, loopback are all under 'ether-options' ethopts = has_xml.find("ether-options") if ethopts is None: return if ethopts.find("loopback") is not None: has_py["loopback"] = True speed = ethopts.find("speed") if speed is not None: # take the first child element has_py["speed"] = speed[0].tag PhyPortBase._set_invert(has_py, "speed", self.PORT_SPEED) Resource.copyifexists(ethopts, "link-mode", has_py, "duplex") if "duplex" in has_py: PhyPortBase._set_invert(has_py, "duplex", self.PORT_DUPLEX)