예제 #1
0
    def delete_flow(self, onu_id, intf_id, flow_id, is_downstream):
        try:
            obj = bal_pb2.BalCfg()
            # Fill Header details
            obj.device_id = self.device_id.encode('ascii', 'ignore')
            obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_FLOW
            # Fill Access Terminal Details
            # To-DO flow ID need to be retrieved from flow details
            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

            obj.flow.data.admin_state = bal_model_types_pb2.BAL_STATE_DOWN
            obj.flow.data.access_int_id = intf_id
            # obj.flow.data.network_int_id = intf_id
            obj.flow.data.sub_term_id = onu_id
            self.log.info('deleting-flows-from-OLT-Device', flow_details=obj)
            yield self.stub.BalCfgSet(obj)
        except Exception as e:
            self.log.info('delete_flow-exception', flow_id, onu_id, exc=str(e))
        return
예제 #2
0
파일: bal.py 프로젝트: bm2535/voltha
    def packet_out(self, pkt, pkt_info):
        obj = bal_pb2.BalCfg()
        obj.device_id = self.device_id.encode('ascii', 'ignore')
        obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_PACKET
        if pkt_info['dest_type'] == 'onu':
            # Set the destination ONU info
            obj.packet.key.packet_send_dest.type = bal_model_types_pb2.BAL_DEST_TYPE_SUB_TERM
            obj.packet.key.packet_send_dest.sub_term.sub_term_id = pkt_info[
                'onu_id']
            # TODO: Need to provide correct values for sub_term_uni and int_id
            #obj.packet.key.packet_send_dest.sub_term.sub_term_uni = egress_port
            obj.packet.key.packet_send_dest.sub_term.intf_id = pkt_info[
                'intf_id']
            obj.packet.data.intf_type = bal_model_types_pb2.BAL_INTF_TYPE_PON
        elif pkt_info['dest_type'] == 'gem_port':
            obj.packet.key.packet_send_dest.type = bal_model_types_pb2.BAL_DEST_TYPE_SVC_PORT
            obj.packet.key.packet_send_dest.svc_port.svc_port_id = pkt_info[
                'gem_port']
            obj.packet.key.packet_send_dest.svc_port.intf_id = pkt_info[
                'intf_id']
            obj.packet.data.intf_type = bal_model_types_pb2.BAL_INTF_TYPE_PON
        elif pkt_info['dest_type'] == 'nni':
            obj.packet.key.packet_send_dest.type = bal_model_types_pb2.BAL_DEST_TYPE_NNI
            obj.packet.key.packet_send_dest.nni.intf_id = pkt_info['intf_id']
        else:
            self.log.error('unsupported-dest-type',
                           dest_type=pkt_info['dest_type'])

        # Set the Packet-out info
        # TODO: Need to provide correct value for intf_id
        obj.packet.data.pkt = pkt
        self.log.info('sending-packet-out', packet_out_details=obj)
        yield self.stub.BalCfgSet(obj)
예제 #3
0
    def create_scheduler(self, id, direction, owner_info, num_priority,
                         rate_info=None):
        try:
            obj = bal_pb2.BalCfg()
            # Fill Header details
            obj.device_id = self.device_id.encode('ascii', 'ignore')
            obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_TM_SCHED
            # Fill Access Terminal Details
            if direction == 'downstream':
                obj.tm_sched_cfg.key.dir = \
                    bal_model_types_pb2.BAL_TM_SCHED_DIR_DS
            else:
                obj.tm_sched_cfg.key.dir = \
                    bal_model_types_pb2.BAL_TM_SCHED_DIR_US
            obj.tm_sched_cfg.key.id = id

            if owner_info['type'] == 'agg_port':
                obj.tm_sched_cfg.data.owner.type = \
                    bal_model_types_pb2.BAL_TM_SCHED_OWNER_TYPE_AGG_PORT
                obj.tm_sched_cfg.data.owner.agg_port.presence_mask = 0
                obj.tm_sched_cfg.data.owner.agg_port.intf_id = \
                    owner_info['intf_id']
                obj.tm_sched_cfg.data.owner.agg_port.presence_mask |= \
                    bal_model_types_pb2.BAL_TM_SCHED_OWNER_AGG_PORT_ID_INTF_ID
                obj.tm_sched_cfg.data.owner.agg_port.sub_term_id = \
                    owner_info['onu_id']
                obj.tm_sched_cfg.data.owner.agg_port.presence_mask |= \
                    bal_model_types_pb2.BAL_TM_SCHED_OWNER_AGG_PORT_ID_SUB_TERM_ID
                obj.tm_sched_cfg.data.owner.agg_port.agg_port_id = \
                    owner_info['alloc_id']
                obj.tm_sched_cfg.data.owner.agg_port.presence_mask |= \
                    bal_model_types_pb2.BAL_TM_SCHED_OWNER_AGG_PORT_ID_AGG_PORT_ID
            else:
                self.log.error('Not-supported-scheduling-type',
                               sched_type=owner_info['type'])
                return
            #obj.tm_sched_cfg.data.sched_type = \
            #    bal_model_types_pb2.BAL_TM_SCHED_TYPE_SP_WFQ
            #obj.tm_sched_cfg.data.num_priorities = num_priority
            if rate_info is not None:
                obj.tm_sched_cfg.data.rate.presence_mask = \
                    bal_model_types_pb2.BAL_TM_SHAPING_ID_ALL
                obj.tm_sched_cfg.data.rate.cir = rate_info['cir']
                obj.tm_sched_cfg.data.rate.pir = rate_info['pir']
                obj.tm_sched_cfg.data.rate.burst = rate_info['burst']

            self.log.info('Creating-Scheduler',
                          scheduler_details=obj)
            yield self.stub.BalCfgSet(obj, timeout=GRPC_TIMEOUT)
        except Exception as e:
            self.log.info('creat-scheduler-exception',
                          olt=self.olt.olt_id,
                          sched_id=id,
                          direction=direction,
                          owner=owner_info,
                          rate=rate_info,
                          exc=str(e))
        return
예제 #4
0
    def deactivate_eapol_flow(self, flow_id, is_downstream,
                              onu_id=None,
                              intf_id=None,
                              network_int_id=None,
                              gemport_id=None,
                              stag=None,
                              dba_sched_id=None,
                              queue_id=None,
                              queue_sched_id=None):
        try:
            obj = bal_pb2.BalCfg()
            # Fill Header details
            obj.device_id = self.device_id.encode('ascii', 'ignore')
            obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_FLOW
            # Fill Access Terminal Details
            # To-DO flow ID need to be retrieved from flow details
            obj.flow.key.flow_id = flow_id
            obj.flow.data.admin_state = bal_model_types_pb2.BAL_STATE_DOWN
            if intf_id is not None:
                obj.flow.data.access_int_id = intf_id
            if network_int_id is not None:
                obj.flow.data.network_int_id = network_int_id
            if onu_id is not None:
                obj.flow.data.sub_term_id = onu_id
            if gemport_id is not None:
                obj.flow.data.svc_port_id = gemport_id

            if is_downstream is True:
                obj.flow.key.flow_type = \
                    bal_model_types_pb2.BAL_FLOW_TYPE_DOWNSTREAM
            else:
                obj.flow.key.flow_type = \
                    bal_model_types_pb2.BAL_FLOW_TYPE_UPSTREAM

            obj.flow.data.classifier.pkt_tag_type = \
                bal_model_types_pb2.BAL_PKT_TAG_TYPE_SINGLE_TAG
            obj.flow.data.classifier.presence_mask |= \
                bal_model_types_pb2.BAL_CLASSIFIER_ID_PKT_TAG_TYPE
            obj.flow.data.classifier.o_vid = stag
            obj.flow.data.classifier.presence_mask |= \
                bal_model_types_pb2.BAL_CLASSIFIER_ID_O_VID
            obj.flow.data.action.cmds_bitmask |= \
                bal_model_types_pb2.BAL_ACTION_CMD_ID_TRAP_TO_HOST
            obj.flow.data.action.presence_mask |= \
                bal_model_types_pb2.BAL_ACTION_ID_CMDS_BITMASK
            if dba_sched_id:
                obj.flow.data.dba_tm_sched_id = dba_sched_id
            if queue_id:
                obj.flow.data.queue.queue_id = queue_id
            if queue_sched_id:
                obj.flow.data.queue.sched_id = queue_sched_id
            self.log.info('deactivating-eapol-flows-from-OLT-Device',
                          flow_details=obj)
            yield self.stub.BalCfgSet(obj, timeout=GRPC_TIMEOUT)
        except Exception as e:
            self.log.exception('deactivate-eapol-flow-exception',
                               flow_id, onu_id, exc=str(e))
        return
예제 #5
0
 def set_access_terminal_admin_state(self, admin_state):
     self.log.info('setting-admin-state',
                   admin_state=admin_state, device_id=self.device_id)
     obj = bal_pb2.BalCfg()
     obj.device_id = self.device_id.encode('ascii', 'ignore')
     obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_ACCESS_TERMINAL
     obj.cfg.key.access_term_id = 0
     obj.cfg.data.admin_state = admin_state
     yield self.stub.BalCfgSet(obj)
예제 #6
0
 def set_access_terminal_admin_state(self, admin_state):
     obj = bal_pb2.BalCfg()
     obj.device_id = self.device_id.encode('ascii', 'ignore')
     obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_ACCESS_TERMINAL
     obj.cfg.key.access_term_id = 0
     obj.cfg.data.admin_state = admin_state
     self.log.info('Admin-stage-change-Access-Terminal-Device',
                   admin_state=admin_state, device_id=self.device_id,
                   access_terminal_details=obj)
     yield self.stub.BalCfgSet(obj, timeout=GRPC_TIMEOUT)
예제 #7
0
    def create_queue(self,
                     id,
                     direction,
                     sched_id,
                     priority=None,
                     weight=None,
                     rate_info=None):
        try:
            obj = bal_pb2.BalCfg()
            # Fill Header details
            obj.device_id = self.device_id.encode('ascii', 'ignore')
            obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_TM_QUEUE
            # Fill Queue Cfg Details
            if direction == 'downstream':
                obj.tm_queue_cfg.key.sched_dir = \
                    bal_model_types_pb2.BAL_TM_SCHED_DIR_DS
            else:
                obj.tm_queue_cfg.key.sched_dir = \
                    bal_model_types_pb2.BAL_TM_SCHED_DIR_US
            obj.tm_queue_cfg.key.id = id
            obj.tm_queue_cfg.key.sched_id = sched_id
            '''
            TO-DO:By default the schedular created is of type sp_wfq,
            which requires either priority or weight but not both.
            Need to fetch schd_type then assign either one of them
            '''
            if weight is not None:
                obj.tm_queue_cfg.data.weight = weight

            if rate_info is not None:
                obj.tm_queue_cfg.data.rate.presence_mask = \
                    bal_model_types_pb2.BAL_TM_SHAPING_ID_ALL
                obj.tm_queue_cfg.data.rate.cir = rate_info['cir']
                obj.tm_queue_cfg.data.rate.pir = rate_info['pir']
                obj.tm_queue_cfg.data.rate.burst = rate_info['burst']
            else:
                obj.tm_queue_cfg.data.rate.presence_mask = \
                    bal_model_types_pb2.BAL_TM_SHAPING_ID_NONE
            obj.tm_queue_cfg.data.creation_mode = \
                    bal_model_types_pb2.BAL_TM_CREATION_MODE_MANUAL
            obj.tm_queue_cfg.data.ref_count = 0

            self.log.info('Creating-Queue', scheduler_details=obj)
            yield self.stub.BalCfgSet(obj, timeout=GRPC_TIMEOUT)
        except Exception as e:
            self.log.info('create-queue-exception',
                          olt=self.olt.olt_id,
                          queue_id=id,
                          direction=direction,
                          sched_id=sched_id,
                          priority=priority,
                          weight=weight,
                          rate_info=rate_info,
                          exc=str(e))
        return
예제 #8
0
    def packet_out(self, onu_id, egress_port, pkt):

        obj = bal_pb2.BalCfg()
        # Set the destination ONU info
        obj.packet.key.dest.packet_send_dest.sub_term.sub_term_id = onu_id
        # TODO: Need to provide correct values for sub_term_uni and int_id
        obj.packet.key.dest.packet_send_dest.sub_term.sub_term_uni = egress_port
        obj.packet.key.dest.packet_send_dest.sub_term.int_id = egress_port

        # Set the Packet-out info
        obj.packet.data.flow_type = bal_model_types_pb2.BAL_FLOW_TYPE_DOWNSTREAM
        # TODO: Need to provide correct value for intf_id
        obj.packet.data.intf_id = egress_port
        obj.packet.data.pkt = pkt
        self.log.info('packet-out',
                      packet_out_details=obj)
        yield self.stub.BalCfgSet(obj)
예제 #9
0
파일: bal.py 프로젝트: shculpepper/voltha
 def deactivate_pon_port(self, olt_no, pon_port, transceiver_type):
     try:
         obj = bal_pb2.BalCfg()
         #            Fill Header details
         obj.device_id = self.device_id.encode('ascii', 'ignore')
         obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_INTERFACE
         #            Fill Access Terminal Details
         obj.interface.key.intf_id = pon_port
         obj.interface.key.intf_type = bal_model_types_pb2.BAL_INTF_TYPE_PON
         obj.interface.data.admin_state = bal_model_types_pb2.BAL_STATE_DOWN
         obj.interface.data.transceiver_type = transceiver_type
         self.log.info('deactivating-pon-port-in-olt',
                       olt=olt_no, pon_port=pon_port,
                       pon_port_details=obj,
                       transceiver_type=transceiver_type)
     except Exception as e:
         self.log.info('deactivating-pon-port in olt-exception', exc=str(e))
     return
예제 #10
0
 def activate_pon_port(self, olt_no, pon_port):
     self.log.info('activating-pon-port in olt',
                   olt=olt_no, pon_port=pon_port)
     try:
         obj = bal_pb2.BalCfg()
         #            Fill Header details
         obj.device_id = self.device_id.encode('ascii', 'ignore')
         obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_INTERFACE
         #            Fill Access Terminal Details
         obj.interface.key.intf_id = pon_port
         obj.interface.key.intf_type = bal_model_types_pb2.BAL_INTF_TYPE_PON
         obj.interface.data.admin_state = bal_model_types_pb2.BAL_STATE_UP
         obj.interface.data.transceiver_type = \
             bal_model_types_pb2.BAL_TRX_TYPE_XGPON_LTH_7226_PC
         yield self.stub.BalCfgSet(obj)
     except Exception as e:
         self.log.info('activating-pon-port in olt-exception', exc=str(e))
     return
예제 #11
0
 def send_omci_request_message(self, proxy_address, msg):
     try:
         obj = bal_pb2.BalCfg()
         #            Fill Header details
         obj.device_id = self.device_id.encode('ascii', 'ignore')
         obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_PACKET
         #            Fill packet Details
         obj.packet.key.packet_send_dest.type = \
             bal_model_types_pb2.BAL_DEST_TYPE_ITU_OMCI_CHANNEL
         obj.packet.key.packet_send_dest.itu_omci_channel.sub_term_id = \
             proxy_address.onu_id
         obj.packet.key.packet_send_dest.itu_omci_channel.intf_id = \
             proxy_address.channel_id
         obj.packet.data.pkt = msg
         self.log.info('send_omci_request_message',
                       proxy_address=proxy_address.channel_id,
                       omci_msg_details=obj)
         yield self.stub.BalCfgSet(obj)
     except Exception as e:
         self.log.info('send-proxied_message-exception', exc=str(e))
     return
예제 #12
0
 def deactivate_onu(self, onu_info):
     try:
         obj = bal_pb2.BalCfg()
         # Fill Header details
         obj.device_id = self.device_id.encode('ascii', 'ignore')
         obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_SUBSCRIBER_TERMINAL
         # Fill Access Terminal Details
         obj.terminal.key.intf_id = onu_info['pon_id']
         obj.terminal.key.sub_term_id = onu_info['onu_id']
         obj.terminal.data.admin_state = bal_model_types_pb2.BAL_STATE_DOWN
         obj.terminal.data.serial_number.vendor_id = onu_info['vendor']
         obj.terminal.data.serial_number.vendor_specific = \
             onu_info['vendor_specific']
         obj.terminal.data.registration_id = onu_info['reg_id']
         self.log.info('deactivating-ONU-in-olt',
                       onu_details=obj)
         yield self.stub.BalCfgSet(obj, timeout=GRPC_TIMEOUT)
     except Exception as e:
         self.log.info('deactivating-ONU-exception',
                       onu_info['onu_id'], exc=str(e))
     return
예제 #13
0
 def activate_onu(self, onu_info):
     self.log.info('activating-ONU in olt',
                   olt=self.olt.olt_id, onu_id=onu_info['onu_id'])
     try:
         obj = bal_pb2.BalCfg()
         # Fill Header details
         obj.device_id = self.device_id.encode('ascii', 'ignore')
         obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_SUBSCRIBER_TERMINAL
         # Fill Access Terminal Details
         obj.terminal.key.intf_id = onu_info['pon_id']
         obj.terminal.key.sub_term_id = onu_info['onu_id']
         obj.terminal.data.admin_state = bal_model_types_pb2.BAL_STATE_UP
         obj.terminal.data.serial_number.vendor_id = onu_info['vendor']
         obj.terminal.data.serial_number.vendor_specific = \
             onu_info['vendor_specific']
         obj.terminal.data.registration_id = \
             '202020202020202020202020202020202020202020202020202020202020202020202020'
         yield self.stub.BalCfgSet(obj)
     except Exception as e:
         self.log.info('activating-ONU-exception',
                       onu_info['onu_id'], exc=str(e))
     return
예제 #14
0
    def add_flow(self,
                 onu_id,
                 intf_id,
                 flow_id,
                 gem_port,
                 classifier_info,
                 is_downstream,
                 action_info=None,
                 sched_id=None):
        try:
            obj = bal_pb2.BalCfg()
            # Fill Header details
            obj.device_id = self.device_id.encode('ascii', 'ignore')
            obj.hdr.obj_type = bal_model_ids_pb2.BAL_OBJ_ID_FLOW
            # Fill Access Terminal Details
            # To-DO flow ID need to be retrieved from flow details
            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
                obj.flow.data.dba_tm_sched_id = sched_id
            else:
                obj.flow.key.flow_type = \
                    bal_model_types_pb2.BAL_FLOW_TYPE_DOWNSTREAM

            obj.flow.data.admin_state = bal_model_types_pb2.BAL_STATE_UP
            obj.flow.data.access_int_id = intf_id
            # obj.flow.data.network_int_id = intf_id
            obj.flow.data.sub_term_id = onu_id
            obj.flow.data.svc_port_id = gem_port
            obj.flow.data.classifier.presence_mask = 0
            if 'eth_type' in classifier_info:
                obj.flow.data.classifier.ether_type = \
                    classifier_info['eth_type']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_ETHER_TYPE
            if 'ip_proto' in classifier_info:
                obj.flow.data.classifier.ip_proto = \
                    classifier_info['ip_proto']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_IP_PROTO
            if 'vlan_vid' in classifier_info:
                obj.flow.data.classifier.o_vid = \
                    classifier_info['vlan_vid']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_O_VID
            if 'vlan_pcp' in classifier_info:
                obj.flow.data.classifier.o_pbits = \
                    classifier_info['vlan_pcp']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_O_PBITS
            if 'udp_src' in classifier_info:
                obj.flow.data.classifier.src_port = \
                    classifier_info['udp_src']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_SRC_PORT
            if 'udp_dst' in classifier_info:
                obj.flow.data.classifier.dst_port = \
                    classifier_info['udp_dst']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_DST_PORT
            if 'ipv4_dst' in classifier_info:
                obj.flow.data.classifier.dst_ip = \
                    classifier_info['ipv4_dst']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_DST_IP
            if 'ipv4_src' in classifier_info:
                obj.flow.data.classifier.src_ip = \
                    classifier_info['ipv4_src']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_SRC_IP
            if 'metadata' in classifier_info:
                obj.flow.data.classifier.i_vid = \
                    classifier_info['metadata']
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_I_VID
            if 'pkt_tag_type' in classifier_info:
                if classifier_info['pkt_tag_type'] == 'single_tag':
                    obj.flow.data.classifier.pkt_tag_type = \
                        bal_model_types_pb2.BAL_PKT_TAG_TYPE_SINGLE_TAG
                elif classifier_info['pkt_tag_type'] == 'double_tag':
                    obj.flow.data.classifier.pkt_tag_type = \
                        bal_model_types_pb2.BAL_PKT_TAG_TYPE_DOUBLE_TAG
                elif classifier_info['pkt_tag_type'] == 'untagged':
                    obj.flow.data.classifier.pkt_tag_type = \
                        bal_model_types_pb2.BAL_PKT_TAG_TYPE_UNTAGGED
                else:
                    obj.flow.data.classifier.pkt_tag_type = \
                        bal_model_types_pb2.BAL_PKT_TAG_TYPE_NONE
                obj.flow.data.classifier.presence_mask |= \
                    bal_model_types_pb2.BAL_CLASSIFIER_ID_PKT_TAG_TYPE

            if action_info is not None:
                obj.flow.data.action.presence_mask = 0
                obj.flow.data.action.cmds_bitmask = 0
                if 'pop_vlan' in action_info:
                    obj.flow.data.action.o_vid = action_info['vlan_vid']
                    obj.flow.data.action.cmds_bitmask |= \
                        bal_model_types_pb2.BAL_ACTION_CMD_ID_REMOVE_OUTER_TAG
                    obj.flow.data.action.presence_mask |= \
                        bal_model_types_pb2.BAL_ACTION_ID_CMDS_BITMASK
                    obj.flow.data.action.presence_mask |= \
                        bal_model_types_pb2.BAL_ACTION_ID_O_VID
                elif 'push_vlan' in action_info:
                    obj.flow.data.action.o_vid = action_info['vlan_vid']
                    obj.flow.data.action.cmds_bitmask |= \
                        bal_model_types_pb2.BAL_ACTION_CMD_ID_ADD_OUTER_TAG
                    obj.flow.data.action.presence_mask |= \
                        bal_model_types_pb2.BAL_ACTION_ID_CMDS_BITMASK
                    obj.flow.data.action.presence_mask |= \
                        bal_model_types_pb2.BAL_ACTION_ID_O_VID
                elif 'trap_to_host' in action_info:
                    obj.flow.data.action.cmds_bitmask |= \
                        bal_model_types_pb2.BAL_ACTION_CMD_ID_TRAP_TO_HOST
                    obj.flow.data.action.presence_mask |= \
                        bal_model_types_pb2.BAL_ACTION_ID_CMDS_BITMASK
                else:
                    self.log.info('Invalid-action-field')
                    return
            self.log.info('adding-flow-to-OLT-Device', flow_details=obj)
            yield self.stub.BalCfgSet(obj)
        except Exception as e:
            self.log.info('add_flow-exception', flow_id, onu_id, exc=str(e))
        return