def get_access_terminal_cfg(self): try: obj = bal_pb2.BalKey() obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_ACCESS_TERMINAL obj.access_term_key.access_term_id = 0 access_term_cfg = yield self.stub.BalCfgGet(obj, timeout=GRPC_TIMEOUT) self.log.debug("rxed-access-term-cfg", access_term_cfg=access_term_cfg) returnValue(access_term_cfg) except Exception as e: self.log.info('get-access-terminal-cfg-exception', exc=str(e)) return
def get_subscriber_terminal_cfg(self, sub_term_id, intf_id): try: obj = bal_pb2.BalKey() obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_SUBSCRIBER_TERMINAL obj.terminal_key.sub_term_id = sub_term_id obj.terminal_key.intf_id = intf_id sub_term_cfg = yield self.stub.BalCfgGet(obj, timeout=GRPC_TIMEOUT) self.log.debug("rxed-sub-term-cfg", sub_term_cfg=sub_term_cfg) returnValue(sub_term_cfg) except Exception as e: self.log.info('get-subscriber-terminal-cfg-exception', exc=str(e)) return
def delete_onu(self, onu_info): try: obj = bal_pb2.BalKey() obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_SUBSCRIBER_TERMINAL # Fill Access Terminal Details obj.terminal_key.sub_term_id = onu_info['onu_id'] obj.terminal_key.intf_id = onu_info['pon_id'] self.log.info('delete-ONU-in-olt', onu_details=obj) yield self.stub.BalCfgClear(obj, timeout=5) except Exception as e: self.log.info('delete-ONU-exception', onu_info['onu_id'], exc=str(e)) return
def delete_flow(self, flow_id, is_downstream): try: obj = bal_pb2.BalKey() # Fill Header details obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_FLOW obj.flow_key.flow_id = flow_id if is_downstream is False: obj.flow_key.flow_type = \ bal_model_types_pb2.BAL_FLOW_TYPE_UPSTREAM else: obj.flow_key.flow_type = \ bal_model_types_pb2.BAL_FLOW_TYPE_DOWNSTREAM self.log.info('deleting-flows-from-OLT-Device', flow_details=obj) resp = yield self.stub.BalCfgClear(obj, timeout=5) except Exception as e: self.log.exception('delete_flow-exception', flow_id, e=e) return
def delete_scheduler(self, id, direction): try: obj = bal_pb2.BalKey() obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_TM_SCHED # Fill Access Terminal Details if direction == 'downstream': obj.tm_sched_key.dir =\ bal_model_types_pb2.BAL_TM_SCHED_DIR_DS else: obj.tm_sched_key.dir = \ bal_model_types_pb2.BAL_TM_SCHED_DIR_US obj.tm_sched_key.id = id self.log.info('Deleting Scheduler', scheduler_details=obj) yield self.stub.BalCfgClear(obj, timeout=GRPC_TIMEOUT) except Exception as e: self.log.info('creat-scheduler-exception', olt=self.olt.olt_id, sched_id=id, direction=direction, exc=str(e)) return
def delete_queue(self, id, direction, sched_id): try: obj = bal_pb2.BalKey() obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_TM_QUEUE # Fill Queue Key Details if direction == 'downstream': obj.tm_queue_key.sched_dir =\ bal_model_types_pb2.BAL_TM_SCHED_DIR_DS else: obj.tm_queue_key.sched_dir = \ bal_model_types_pb2.BAL_TM_SCHED_DIR_US obj.tm_queue_key.id = id obj.tm_queue_key.sched_id = sched_id self.log.info('Deleting-Queue', queue_details=obj) yield self.stub.BalCfgClear(obj, timeout=GRPC_TIMEOUT) except Exception as e: self.log.info('delete-queue-exception', olt=self.olt.olt_id, queue_id=id, direction=direction, sched_id=sched_id, exc=str(e)) return