Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
 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"))
Beispiel #4
0
 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'))
Beispiel #5
0
 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'))
Beispiel #6
0
 def _xml_change_mtu(self, xml):
     Resource.xml_set_or_delete(xml, "mtu", self.mtu)
     return True
Beispiel #7
0
 def _xml_change_admin(self, xml):
     xml.append(Resource.xmltag_set_or_del("disable",
                                           (self.admin is False)))
     return True
Beispiel #8
0
 def _xml_change_mtu(self, xml):
     Resource.xml_set_or_delete(xml, 'mtu', self.mtu)
     return True
Beispiel #9
0
 def _xml_change_admin(self, xml):
     xml.append(
         Resource.xmltag_set_or_del(
             'disable',
             (self.admin == False)))
     return True
Beispiel #10
0
 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
Beispiel #11
0
 def _xml_change_duplex(self, xml):
     value = self.PORT_DUPLEX.get(self.duplex)
     Resource.xml_set_or_delete(xml, 'link-mode', value)
     return True
Beispiel #12
0
 def _xml_change_speed(self, xml):
     Resource.xml_set_or_delete(xml, 'speed', self.speed)
     return True