2007年04月07日 星期六 18:56
python½Å±¾£¬Éú³Éxml£¬ÒòΪÎÒµÄxmlºÜ¼òµ¥£¬Ã»ÓÐʹÓÃdom£® #!/usr/bin/env python class Ipvs: types = '' vip = '0.0.0.0' vport = '0' scheduler = '' nodes = [] """ def __init__(self, vs): self.types = vs[0] self.vip = vs[1] self.vport = vs[2] self.scheduler = vs[3] self.nodes = vs[4] """ class Node: nip = '0.0.0.0' nport = '' forward = '' weight = 0 active = 0 inact = 0 def __init__(self, node): nip = node[0] nport = node[1] forward = node[2] weight = node[3] active = node[4] incat = node[5] self.nip = nip self.nport = nport self.forward = forward self.weight = weight self.active = active self.inact = incat class Monitor: buffer = [] ipvsdict = {} def __init__(self): self.buffer.append('') self.buffer.append('') #self.make() pass def clear(self): self.buffer = [] self.ipvss = [] def make(self): self.buffer.append('') for key in self.ipvsdict: ipvs = self.ipvsdict[key] self.node(ipvs.nodes,ipvs.vip+':'+ipvs.vport+' '+ipvs.scheduler) self.buffer.append(' ') def header(self,vs): self.buffer.append('') def node(self, nodes, caption): self.buffer.append('
Zeuux © 2025
京ICP备05028076号