Пример #1
0
    def on_gemport_create(self, gem_port):
        from onu_gem_port import OnuGemPort
        assert self._pon is not None, 'No PON port'

        gem_port['object'] = OnuGemPort.create(self, gem_port,
                                               self._pon.next_gem_entity_id)
        self._pon.add_gem_port(gem_port['object'])
        return gem_port
Пример #2
0
    def on_gemport_create(self, gem_port):
        from onu_gem_port import OnuGemPort

        gem_port['object'] = OnuGemPort.create(self, gem_port, is_mock=self.is_mock)
        # Look up any PON port  # TODO: Add the vont-ani 'name' to the PON Port and look up that way
        pon_port = self.pon_ports[0]
        if pon_port is not None:
            pon_port.add_gem_port(gem_port['object'])

        return gem_port
Пример #3
0
    def on_gemport_create(self, gem_port):
        from onu_gem_port import OnuGemPort

        gem_port['object'] = OnuGemPort.create(self,
                                               gem_port,
                                               is_mock=self.is_mock)
        # Look up any PON port  # TODO: Add the vont-ani 'name' to the PON Port and look up that way
        pon_port = self.pon_ports[0]
        if pon_port is not None:
            pon_port.add_gem_port(gem_port['object'])

        return gem_port
Пример #4
0
    def _create_gemports(self, upstream_ports, downstream_ports, tcont, uni_id, tech_profile_id):
        """
        Create GEM Ports for a specifc tech profile

        The routine will attempt to combine upstream and downstream GEM Ports into bidirectional
        ports where possible

        :param upstream_ports: (list of IGemPortAttribute) Upstream GEM Port attributes
        :param downstream_ports: (list of IGemPortAttribute) Downstream GEM Port attributes
        :param tcont: (OnuTCont) Associated TCONT
        :param uni_id: (int) UNI Instance ID
        :param tech_profile_id: (int) Tech Profile ID
        """
        self.log.debug('create-gemports', upstream=upstream_ports,
                       downstream_ports=downstream_ports,
                       tcont=tcont, tech_id=tech_profile_id)
        # Convert GEM Port lists to dicts with GEM ID as they key
        upstream = {gem['gemport_id']: gem for gem in upstream_ports}
        downstream = {gem['gemport_id']: gem for gem in downstream_ports}

        upstream_ids = set(upstream.keys())
        downstream_ids = set(downstream.keys())
        bidirectional_ids = upstream_ids & downstream_ids

        gem_port_types = {     # Keys are the 'direction' attribute value, value is list of GEM attributes
            1: [upstream[gid] for gid in upstream_ids - bidirectional_ids],
            2: [downstream[gid] for gid in downstream_ids - bidirectional_ids],
            3: [upstream[gid] for gid in bidirectional_ids]
        }
        for direction, gem_list in gem_port_types.items():
            for gem in gem_list:
                gem_data = {
                    'gemport-id': gem['gemport_id'],
                    'direction': direction,
                    'encryption': gem['aes_encryption'].lower() == 'true',
                    'discard-policy': gem['discard_policy'],
                    'max-q-size': gem['max_q_size'],
                    'pbit-map': gem['pbit_map'],
                    'priority-q': gem['priority_q'],
                    'scheduling_policy': gem['scheduling_policy'],
                    'weight': gem['weight'],
                    'uni-id': uni_id,
                    'discard_config': {
                        'max-probability': gem['discard_config']['max_probability'],
                        'max-threshold': gem['discard_config']['max_threshold'],
                        'min-threshold': gem['discard_config']['min_threshold'],
                    },
                }
                gem_port = OnuGemPort.create(self, gem_data, tcont.alloc_id,
                                             tech_profile_id, uni_id,
                                             self._pon.next_gem_entity_id)
                self._pon.add_gem_port(gem_port)