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): # common to all subclasses Resource._r_has_xml_status(has_xml, has_py) has_py["admin"] = bool(has_xml.find("disable") is None) Resource.copyifexists(has_xml, "description", has_py) Resource.copyifexists(has_xml, "mtu", has_py) has_py["$unit_count"] = len(has_xml.findall("unit"))
def _xml_to_py(self, has_xml, has_py): # common to all subclasses Resource._r_has_xml_status(has_xml, has_py) has_py['admin'] = bool(has_xml.find('disable') is None) Resource.copyifexists(has_xml, 'description', has_py) Resource.copyifexists(has_xml, 'mtu', has_py) has_py['$unit_count'] = len(has_xml.findall('unit'))
def _xml_change_mtu(self, xml): Resource.xml_set_or_delete(xml, "mtu", self.mtu) return True
def _xml_change_admin(self, xml): xml.append(Resource.xmltag_set_or_del("disable", (self.admin is False))) return True
def _xml_change_mtu(self, xml): Resource.xml_set_or_delete(xml, 'mtu', self.mtu) return True
def _xml_change_admin(self, xml): xml.append( Resource.xmltag_set_or_del( 'disable', (self.admin == False))) return True
def _xml_change_loopback(self, xml): opts = E('gigether-options') opts.append(Resource.xmltag_set_or_del('loopback', self.loopback)) xml.append(opts) return True
def _xml_change_duplex(self, xml): value = self.PORT_DUPLEX.get(self.duplex) Resource.xml_set_or_delete(xml, 'link-mode', value) return True
def _xml_change_speed(self, xml): Resource.xml_set_or_delete(xml, 'speed', self.speed) return True