Пример #1
0
    def add_to_hardware(self, omci, tcont_entity_id):
        self.log.debug('add-to-hardware', tcont_entity_id=tcont_entity_id)

        self._entity_id = tcont_entity_id

        try:
            frame = TcontFrame(self.entity_id, self.alloc_id).set()
            results = yield omci.send(frame)

            status = results.fields['omci_message'].fields['success_code']
            failed_attributes_mask = results.fields['omci_message'].fields[
                'failed_attributes_mask']
            unsupported_attributes_mask = results.fields[
                'omci_message'].fields['unsupported_attributes_mask']
            self.log.debug(
                'set-tcont',
                status=status,
                failed_attributes_mask=failed_attributes_mask,
                unsupported_attributes_mask=unsupported_attributes_mask)

        except Exception as e:
            self.log.exception('tcont-set', e=e)
            raise

        returnValue(results)
Пример #2
0
    def remove_from_hardware(self, omci):
        self.log.debug('remove-from-hardware', tcont_entity_id=self.entity_id)

        # Release tcont by setting alloc_id=0xFFFF
        try:
            frame = TcontFrame(self.entity_id, 0xFFFF).set()
            results = yield omci.send(frame)

            status = results.fields['omci_message'].fields['success_code']
            self.log.debug('delete-tcont', status=status)

        except Exception as e:
            self.log.exception('tcont-delete', e=e)
            raise

        returnValue(results)
Пример #3
0
    def remove_from_hardware(self, omci):
        self.log.debug('remove-from-hardware', tcont_entity_id=self.entity_id)
        try:
            frame = TcontFrame(self.entity_id, self._free_alloc_id).set()
            results = yield omci.send(frame)

            status = results.fields['omci_message'].fields['success_code']
            self.log.debug('delete-tcont', status=status)

            if status == ReasonCodes.Success:
                self._entity_id = None

        except Exception as e:
            self.log.exception('tcont-delete', e=e)
            raise

        returnValue(results)
Пример #4
0
    def add_to_hardware(self,
                        omci,
                        tcont_entity_id,
                        prev_alloc_id=FREE_TCONT_ALLOC_ID):
        self.log.debug('add-to-hardware', tcont_entity_id=tcont_entity_id)
        if self._is_mock:
            returnValue('mock')

        if self._entity_id == tcont_entity_id:
            returnValue('Already set')

        elif self.entity_id is not None:
            raise KeyError('TCONT already assigned: {}'.format(self.entity_id))

        try:
            # TODO: Look up ONU2-G QoS flexibility attribute and only set this
            #       if q-sched-policy  can be supported

            self._free_alloc_id = prev_alloc_id
            frame = TcontFrame(tcont_entity_id, self.alloc_id).set()
            results = yield omci.send(frame)

            status = results.fields['omci_message'].fields['success_code']
            if status == ReasonCodes.Success:
                self._entity_id = tcont_entity_id

            failed_attributes_mask = results.fields['omci_message'].fields[
                'failed_attributes_mask']
            unsupported_attributes_mask = results.fields[
                'omci_message'].fields['unsupported_attributes_mask']

            self.log.debug(
                'set-tcont',
                status=status,
                failed_attributes_mask=failed_attributes_mask,
                unsupported_attributes_mask=unsupported_attributes_mask)

        except Exception as e:
            self.log.exception('tcont-set', e=e)
            raise

        returnValue(results)
Пример #5
0
    def add_to_hardware(self,
                        omci,
                        tcont_entity_id,
                        prev_alloc_id=free_tcont_alloc_id):
        self.log.debug('add-to-hardware', tcont_entity_id=tcont_entity_id)

        if self._entity_id == tcont_entity_id:
            returnValue('Already set')

        elif self.entity_id is not None:
            raise KeyError('TCONT already assigned: {}'.format(self.entity_id))

        try:
            self._free_alloc_id = prev_alloc_id
            frame = TcontFrame(tcont_entity_id, self.alloc_id).set()
            results = yield omci.send(frame)

            status = results.fields['omci_message'].fields['success_code']
            if status == ReasonCodes.Success:
                self._entity_id = tcont_entity_id

            failed_attributes_mask = results.fields['omci_message'].fields[
                'failed_attributes_mask']
            unsupported_attributes_mask = results.fields[
                'omci_message'].fields['unsupported_attributes_mask']

            self.log.debug(
                'set-tcont',
                status=status,
                failed_attributes_mask=failed_attributes_mask,
                unsupported_attributes_mask=unsupported_attributes_mask)

        except Exception as e:
            self.log.exception('tcont-set', e=e)
            raise

        returnValue(results)