def subscriber(self, tbl_id, operation, ds_id, ds_id2, field_id, data): #print "LoadBalanceSrcL4Handler subscriber called" tbl_lag_global = tbl_pb2.tbl_lag_global() try: tbl_lag_global.ParseFromString(data) except: print 'ERROR!! Parse tbl_lag_global fail' return #print tbl_lag_global.load_balance if operation == CDB_OPER_ADD or operation == CDB_OPER_SET: if (tbl_lag_global.load_balance & GLB_LAG_LOAD_BALANCE_SRC_PORT) == 0: LOADBALANCE_SRCL4.update(GLB_STATE_DISABLE) else: LOADBALANCE_SRCL4.update(GLB_STATE_ENABLE)
def subscriber(self, tbl_id, operation, ds_id, ds_id2, field_id, data): tbl_lag_global = tbl_pb2.tbl_lag_global() try: tbl_lag_global.ParseFromString(data) except: print 'ERROR!! Parse tbl_lag_global fail' return rr_cfg = tbl_lag_global.load_balance_mode rr_cfg = [ord(x) for x in rr_cfg] if operation == CDB_OPER_ADD or operation == CDB_OPER_SET: x = TBL_ROUND_ROBIN_GROUPID_MIN while x <= TBL_ROUND_ROBIN_GROUPID_MAX: newRow = ROROBIN_CFG_TABLE.addRow([AGENT.Integer32(x)]) if rr_cfg[x] == GLB_ROUND_ROBIN_LOAD_BALANCE: newRow.setRowCell(TBL_ROUND_ROBIN_CFG_STATUS, AGENT.Integer32(GLB_STATE_ENABLE)) else: newRow.setRowCell(TBL_ROUND_ROBIN_CFG_STATUS, AGENT.Integer32(GLB_STATE_DISABLE)) x += 1