def __init__(self, _id, dp_id, conf): super(Meter, self).__init__(_id, dp_id, conf) assert conf['entry'] assert conf['entry']['flags'] assert conf['entry']['bands'] conf['entry']['meter_id'] = self.meter_id self.entry_msg = meteradd(self.entry)
def add_meters(self, added_meters): """Add new meters.""" ofmsgs = [] if added_meters: for added_meter in added_meters: ofmsgs.append(valve_of.meteradd( self.meters.get(added_meter).entry, command=0)) return ofmsgs
def change_meters(self, changed_meters): """Change existing meters with same name/ID.""" ofmsgs = [] if changed_meters: for changed_meter in changed_meters: ofmsgs.append( valve_of.meteradd(self.meters.get(changed_meter).entry, command=1)) return ofmsgs