Beispiel #1
0
 def serialize(self):
     serialized = {
         'ethernets': list2dict([ethernet.serialize() for ethernet in self.iterEthernets()]),
         'vlans': list2dict([vlan.serialize() for vlan in self.iterVlans()]),
         'bondings': list2dict([bonding.serialize() for bonding in self.iterBondings()]),
         'DATASTRUCTURE_VERSION': DATASTRUCTURE_VERSION
         }
     return serialized
Beispiel #2
0
 def serialize(self):
     serialized = Interface.serialize(self)
     serialized['vlans'] = list2dict(
         (
         vlan if isinstance(vlan, (unicode, str)) else vlan.system_name
         for vlan in self.vlans
         )
         )
     return serialized
Beispiel #3
0
 def serialize(self):
     serialized = PersistentID.serialize(self)
     for attr in Interface._STD_ATTRS:
         serialized[attr] = serializeElement(getattr(self, attr))
     for attr in 'nets routes'.split():
         collection = getattr(self, attr)
         serialized[attr] = list2dict(
             (item.serialize() for item in collection)
         )
     return serialized
Beispiel #4
0
 def serialize(self):
     serialized = Vlanable.serialize(self)
     serialized['id'] = self.id
     serialized['raw_devices'] = list2dict((device.system_name for device in self.ethernets))
     return serialized