コード例 #1
0
    def update_mib_data_sync(self):
        """
        As the final step of MIB resynchronization, the OLT sets the MIB data sync
        attribute of the ONU data ME to some suitable value of its own choice. It
        then sets its own record of the same attribute to the same value,
        incremented by 1, as explained in clause

        :return: (int, int) success, failure counts
        """
        # Get MDS to set, do not user zero

        new_mds_value = self._sync_sm.mib_data_sync
        if new_mds_value == 0:
            self._sync_sm.increment_mib_data_sync()
            new_mds_value = self._sync_sm.mib_data_sync

        # Update it.  The set response will be sent on the OMCI-CC pub/sub bus
        # and the MIB Synchronizer will update this MDS value in the database
        # if successful.
        try:
            frame = OntDataFrame(mib_data_sync=new_mds_value).set()

            results = yield self._device.omci_cc.send(frame)
            self.check_status_and_state(results, 'ont-data-mbs-update')
            returnValue((1, 0))

        except TimeoutError as e:
            self.log.debug('ont-data-send-timeout', e=e)
            returnValue((0, 1))

        except Exception as e:
            self.log.exception('ont-data-send', e=e, mds=new_mds_value)
            returnValue((0, 1))
コード例 #2
0
    def send_mib_upload(self,
                        timeout=DEFAULT_OMCI_TIMEOUT,
                        high_priority=False):
        self.log.debug('send-mib-upload')

        frame = OntDataFrame().mib_upload()
        return self.send(frame, timeout=timeout, high_priority=high_priority)
コード例 #3
0
    def send_get_all_alarm_next(self,
                                seq_no,
                                timeout=DEFAULT_OMCI_TIMEOUT,
                                high_priority=False):
        self.log.debug('send_get_alarm_next')

        frame = OntDataFrame().get_all_alarm_next(seq_no)
        return self.send(frame, timeout=timeout, high_priority=high_priority)
コード例 #4
0
    def send_get_all_alarm(self,
                           alarm_retrieval_mode=0,
                           timeout=DEFAULT_OMCI_TIMEOUT,
                           high_priority=False):
        self.log.debug('send_get_alarm')

        frame = OntDataFrame().get_all_alarm(alarm_retrieval_mode)
        return self.send(frame, timeout=timeout, high_priority=high_priority)
コード例 #5
0
    def send_mib_upload_next(self,
                             seq_no,
                             timeout=DEFAULT_OMCI_TIMEOUT,
                             high_priority=False):
        self.log.debug('send-mib-upload-next')

        frame = OntDataFrame(sequence_number=seq_no).mib_upload_next()
        return self.send(frame, timeout=timeout, high_priority=high_priority)
コード例 #6
0
    def _get_current_mds(self):
        self.strobe_watchdog()
        results = yield self._device.omci_cc.send(OntDataFrame().get())

        omci_msg = results.fields['omci_message'].fields
        status = omci_msg['success_code']
        mds = (omci_msg['data']['mib_data_sync'] >> 8) & 0xFF \
            if status == 0 and 'data' in omci_msg and 'mib_data_sync' in omci_msg['data'] else -1
        returnValue(mds)
コード例 #7
0
    def send_mib_reset(self,
                       timeout=DEFAULT_OMCI_TIMEOUT,
                       high_priority=False):
        """
        Perform a MIB Reset
        """
        self.log.debug('send-mib-reset')

        frame = OntDataFrame().mib_reset()
        return self.send(frame, timeout=timeout, high_priority=high_priority)
コード例 #8
0
    def perform_get_mds(self):
        """
        Get the 'mib_data_sync' attribute of the ONU
        """
        self.log.debug('perform-get-mds')

        try:
            device = self.omci_agent.get_device(self.device_id)

            #########################################
            # Request (MDS supplied value does not matter for a 'get' request)

            self.strobe_watchdog()
            results = yield device.omci_cc.send(OntDataFrame().get())

            omci_msg = results.fields['omci_message'].fields
            status = omci_msg['success_code']

            # Note: Currently the data reported by the Scapy decode is 16-bits since we need
            #       the data field that large in order to support MIB and Alarm Upload Next
            #       commands.  Select only the first 8-bits since that is the size of the MIB
            #       Data Sync attribute
            mds = (omci_msg['data']['mib_data_sync'] >> 8) & 0xFF \
                if 'data' in omci_msg and 'mib_data_sync' in omci_msg['data'] else -1

            self.log.debug('ont-data-mds', status=status, mib_data_sync=mds)

            assert status == RC.Success, 'Unexpected Response Status: {}'.format(
                status)

            # Successful if here
            self.deferred.callback(mds)

        except TimeoutError as e:
            self.log.warn('get-mds-timeout', e=e)
            self.deferred.errback(failure.Failure(e))

        except Exception as e:
            self.log.exception('get-mds', e=e)
            self.deferred.errback(failure.Failure(e))
コード例 #9
0
    def update_mib_data_sync(self, successes):
        """
        As the final step of MIB resynchronization, the OLT sets the MIB data sync
        attribute of the ONU data ME to some suitable value of its own choice. It
        then sets its own record of the same attribute to the same value,
        incremented by 1, as explained in clause

        :return: (int, int) success, failure counts
        """
        # Get MDS to set
        new_mds_value = self.calculate_new_mds(successes)
        self.log.debug('mds-from-successes', successes=successes, new_mds=new_mds_value)

        # Update it.  The set response will be sent on the OMCI-CC pub/sub bus
        # and the MIB Synchronizer will update this MDS value in the database
        # if successful.
        try:
            previous_mds = yield self._get_current_mds()

            frame = OntDataFrame(mib_data_sync=new_mds_value).set()

            results = yield self._device.omci_cc.send(frame)
            self.check_status_and_state(results, 'ont-data-mds-update')

            # Verify new MDS value was received. Should be 1 greater than what was sent
            new_mds = yield self._get_current_mds()
            self.log.info('mds-set', onu_old_mds=previous_mds, sent_mds=new_mds_value, onu_new_mds=new_mds)
            returnValue((1, 0))

        except TimeoutError as e:
            self.log.debug('ont-data-send-timeout', e=e)
            returnValue((0, 1))

        except Exception as e:
            self.log.exception('ont-data-send', e=e, mds=new_mds_value)
            returnValue((0, 1))
コード例 #10
0
 def send_mib_reset(self,
                    timeout=DEFAULT_OMCI_TIMEOUT,
                    high_priority=False):
     frame = OntDataFrame().mib_reset()
     return self.send(frame, timeout=timeout, high_priority=high_priority)