コード例 #1
0
 def _create_mac_bridge_configuration_data(self):
     self.log.debug('starting-create-mac-bridge-conf-data')
     attributes = dict(
         bridge_id_pointer=self._mac_bridge_configuration_data_id,
         port_num=0xf0,
         tp_type=6,
         tp_pointer=self._mcast_gem_id)
     msg = MacBridgePortConfigurationDataFrame(
         entity_id=self._mac_bridge_configuration_data_id,
         attributes=attributes)
     yield self._send_msg(msg, 'create', 'create-mac-bridge-port-conf-data')
    def _delete__8021p_mapper__ani_mac_bridge_port(self):

        omci_cc = self._onu_device.omci_cc

        try:
            ################################################################################
            # Delete 8021p mapper
            ################################################################################
            msg = Ieee8021pMapperServiceProfileFrame(
                self._ieee_mapper_service_profile_entity_id +
                self._uni_port.mac_bridge_port_num + self._tp_table_id)
            frame = msg.delete()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(results,
                                        'delete-8021p-mapper-service-profile')

            ################################################################################
            # Delete MacBridgePortConfigData
            ################################################################################
            # TODO: magic. make a static variable for tp_type
            msg = MacBridgePortConfigurationDataFrame(
                self._mac_bridge_port_ani_entity_id +
                self._uni_port.entity_id + self._tp_table_id,  # Entity ID
            )
            frame = msg.delete()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results,
                'delete-mac-bridge-port-configuration-data-8021p-mapper')

        except TimeoutError as e:
            self.log.warn('rx-timeout-8021p-ani-port-delete', e=e)
            raise

        except Exception as e:
            self.log.exception('omci-delete-8021p-ani-port-delete', e=e)
            raise
    def perform_uni_initial_bridge_setup(self, uni_port):
        omci_cc = self._onu_device.omci_cc
        frame = None
        try:
            ################################################################################
            # Common - PON and/or UNI                                                      #
            ################################################################################
            # MAC Bridge Service Profile
            #
            #  EntityID will be referenced by:
            #            - MAC Bridge Port Configuration Data (PON & UNI)
            #  References:
            #            - Nothing

            # TODO: magic. event if static, assign to a meaningful variable name
            attributes = {
                'spanning_tree_ind': False,
                'learning_ind': True,
                'priority': 0x8000,
                'max_age': 20 * 256,
                'hello_time': 2 * 256,
                'forward_delay': 15 * 256,
                'unknown_mac_address_discard': True
            }
            msg = MacBridgeServiceProfileFrame(
                self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num, attributes)
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(results,
                                        'create-mac-bridge-service-profile')

            ################################################################################
            # UNI Specific                                                                 #
            ################################################################################
            # MAC Bridge Port config
            # This configuration is for Ethernet UNI
            #
            #  EntityID will be referenced by:
            #            - Nothing
            #  References:
            #            - MAC Bridge Service Profile (the bridge)
            #            - PPTP Ethernet or VEIP UNI

            # default to PPTP
            tp_type = 1
            if uni_port.type.value == UniType.VEIP.value:
                tp_type = 11
            elif uni_port.type.value == UniType.PPTP.value:
                tp_type = 1

            msg = MacBridgePortConfigurationDataFrame(
                self._mac_bridge_port_ani_entity_id +
                uni_port.entity_id,  # Entity ID
                bridge_id_pointer=self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num,  # Bridge Entity ID
                port_num=uni_port.mac_bridge_port_num,  # Port ID
                tp_type=tp_type,  # PPTP Ethernet or VEIP UNI
                tp_pointer=uni_port.entity_id  # Ethernet UNI ID
            )
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results, 'create-mac-bridge-port-configuration-data-uni-port')

        except TimeoutError as e:
            self.log.warn('rx-timeout-inital-per-uni-setup', e=e)
            raise

        except Exception as e:
            self.log.exception('omci-setup-initial-per-uni-setup', e=e)
            raise

        returnValue(None)
コード例 #4
0
    def _setup__8021p_mapper__ani_mac_bridge_port(self):

        omci_cc = self._onu_device.omci_cc

        try:
            ################################################################################
            # PON Specific                                                                 #
            ################################################################################
            # IEEE 802.1 Mapper Service config - One per tech-profile per UNI
            #
            #  EntityID will be referenced by:
            #            - MAC Bridge Port Configuration Data for the PON port and TP ID
            #  References:
            #            - Nothing at this point. When a GEM port is created, this entity will
            #              be updated to reference the GEM Interworking TP

            msg = Ieee8021pMapperServiceProfileFrame(
                self._ieee_mapper_service_profile_entity_id +
                self._uni_port.mac_bridge_port_num + self._tp_table_id)
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(results,
                                        'create-8021p-mapper-service-profile')

            ################################################################################
            # Create MAC Bridge Port Configuration Data for the PON port via IEEE 802.1
            # mapper service and this per TechProfile. Upon receipt by the ONU, the ONU will create an instance
            # of the following before returning the response.
            #
            #     - MAC bridge port designation data
            #     - MAC bridge port filter table data
            #     - MAC bridge port bridge table data
            #
            #  EntityID will be referenced by:
            #            - Implicitly by the VLAN tagging filter data
            #  References:
            #            - MAC Bridge Service Profile (the bridge)
            #            - IEEE 802.1p mapper service profile for PON port

            # TODO: magic. make a static variable for tp_type
            msg = MacBridgePortConfigurationDataFrame(
                self._mac_bridge_port_ani_entity_id +
                self._uni_port.entity_id + self._tp_table_id,  # Entity ID
                bridge_id_pointer=(self._mac_bridge_service_profile_entity_id +
                                   self._uni_port.mac_bridge_port_num),
                # Bridge Entity ID
                port_num=0xff,  # Port ID - unique number within the bridge
                tp_type=3,  # TP Type (IEEE 802.1p mapper service)
                tp_pointer=(self._ieee_mapper_service_profile_entity_id +
                            self._uni_port.mac_bridge_port_num +
                            self._tp_table_id)
                # TP ID, 8021p mapper ID
            )
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results,
                'create-mac-bridge-port-configuration-data-8021p-mapper')

        except TimeoutError as e:
            self.log.warn('rx-timeout-8021p-ani-port-setup', e=e)
            raise

        except Exception as e:
            self.log.exception('omci-setup-8021p-ani-port-setup', e=e)
            raise
コード例 #5
0
    def perform_uni_initial_bridge_setup(self, uni_port):
        omci_cc = self._onu_device.omci_cc
        frame = None
        try:
            ################################################################################
            # Common - PON and/or UNI                                                      #
            ################################################################################
            # MAC Bridge Service Profile
            #
            #  EntityID will be referenced by:
            #            - MAC Bridge Port Configuration Data (PON & UNI)
            #  References:
            #            - Nothing

            # TODO: magic. event if static, assign to a meaningful variable name
            attributes = {
                'spanning_tree_ind': False,
                'learning_ind': False,
                'priority': 0x8000,
                'max_age': 20 * 256,
                'hello_time': 2 * 256,
                'forward_delay': 15 * 256,
                'unknown_mac_address_discard': False
            }
            msg = MacBridgeServiceProfileFrame(
                self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num, attributes)
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(results,
                                        'create-mac-bridge-service-profile')

            ################################################################################
            # UNI Specific                                                                 #
            ################################################################################
            # MAC Bridge Port config
            # This configuration is for Ethernet UNI
            #
            #  EntityID will be referenced by:
            #            - Nothing
            #  References:
            #            - MAC Bridge Service Profile (the bridge)
            #            - PPTP Ethernet or VEIP UNI

            # default to PPTP
            tp_type = 1
            association_type = 2
            if uni_port.type.value == UniType.VEIP.value:
                tp_type = 11
                association_type = 10

            msg = MacBridgePortConfigurationDataFrame(
                self._mac_bridge_port_ani_entity_id +
                uni_port.entity_id,  # Entity ID
                bridge_id_pointer=self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num,  # Bridge Entity ID
                port_num=uni_port.mac_bridge_port_num,  # Port ID
                tp_type=tp_type,  # PPTP Ethernet or VEIP UNI
                tp_pointer=uni_port.entity_id  # Ethernet UNI ID
            )
            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results, 'create-mac-bridge-port-configuration-data-uni-port')

            ################################################################################
            # Create Extended VLAN Tagging Operation config (UNI-side)
            #
            #  EntityID relates to the VLAN TCIS later used int vlan filter task.  This only
            #  sets up the inital MIB entry as it relates to port config, it does not set vlan
            #  that is saved for the vlan filter task
            #
            #  References:
            #            - PPTP Ethernet or VEIP UNI
            #

            attributes = dict(
                association_type=
                association_type,  # Assoc Type, PPTP/VEIP Ethernet UNI
                associated_me_pointer=uni_port.
                entity_id,  # Assoc ME, PPTP/VEIP Entity Id

                # See VOL-1311 - Need to set table during create to avoid exception
                # trying to read back table during post-create-read-missing-attributes
                # But, because this is a R/W attribute. Some ONU may not accept the
                # value during create. It is repeated again in a set below.
                input_tpid=self._input_tpid,  # input TPID
                output_tpid=self._output_tpid,  # output TPID
            )

            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
                self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num,  # Bridge Entity ID
                attributes=attributes)

            frame = msg.create()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results,
                'create-extended-vlan-tagging-operation-configuration-data')

            attributes = dict(
                # Specifies the TPIDs in use and that operations in the downstream direction are
                # inverse to the operations in the upstream direction
                input_tpid=self._input_tpid,  # input TPID
                output_tpid=self._output_tpid,  # output TPID
                downstream_mode=0,  # inverse of upstream
            )

            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
                self._mac_bridge_service_profile_entity_id +
                uni_port.mac_bridge_port_num,  # Bridge Entity ID
                attributes=attributes)

            frame = msg.set()
            self.log.debug('openomci-msg', omci_msg=msg)
            self.strobe_watchdog()
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results,
                'set-extended-vlan-tagging-operation-configuration-data')

        except TimeoutError as e:
            self.log.warn('rx-timeout-inital-per-uni-setup', e=e)
            raise

        except Exception as e:
            self.log.exception('omci-setup-initial-per-uni-setup', e=e)
            raise

        returnValue(None)
コード例 #6
0
    def _delete_and_recreate__8021p_mapper__ani_mac_bridge_port(self):

        omci_cc = self._onu_device.omci_cc

        try:
            # First clean up the Gem Ports references by the old 8021pMapper
            ieee_8021p_mapper = self._onu_device.query_mib(
                Ieee8021pMapperServiceProfile.class_id)
            for k, v in ieee_8021p_mapper.items():
                if not isinstance(v, dict):
                    continue
                # Check the entity-id of the instance matches what we expect
                # for this Uni/TechProfileId
                if k == (self._ieee_mapper_service_profile_entity_id +
                         self._uni_port.mac_bridge_port_num +
                         self._tp_table_id):
                    for i in range(8):
                        gem_entity_id = v.get('attributes', {}). \
                            get('interwork_tp_pointer_for_p_bit_priority_' + str(i), OmciNullPointer)
                        if gem_entity_id is not OmciNullPointer:
                            self.log.debug('remove-from-hardware',
                                           gem_id=gem_entity_id)
                            try:
                                msg = GemInterworkingTpFrame(gem_entity_id)
                                frame = msg.delete()
                                self.log.debug('openomci-msg', omci_msg=msg)
                                results = yield omci_cc.send(frame)
                                self.check_status_and_state(
                                    results, 'delete-gem-port-network-ctp')
                            except Exception as e:
                                self.log.exception('interworking-delete', e=e)
                                raise

                            try:
                                msg = GemPortNetworkCtpFrame(gem_entity_id)
                                frame = msg.delete()
                                self.log.debug('openomci-msg', omci_msg=msg)
                                results = yield omci_cc.send(frame)
                                self.check_status_and_state(
                                    results, 'delete-gem-interworking-tp')
                            except Exception as e:
                                self.log.exception('gemport-delete', e=e)
                                raise
                    break

            # Then delete 8021pMapper ME
            msg = Ieee8021pMapperServiceProfileFrame(
                self._ieee_mapper_service_profile_entity_id +
                self._uni_port.mac_bridge_port_num + self._tp_table_id)
            frame = msg.delete()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(results,
                                        'delete-8021p-mapper-service-profile')

            # Then delete ANI Mac Bridge port
            msg = MacBridgePortConfigurationDataFrame(
                self._mac_bridge_port_ani_entity_id +
                self._uni_port.entity_id + self._tp_table_id  # Entity ID
            )
            frame = msg.delete()
            self.log.debug('openomci-msg', omci_msg=msg)
            results = yield omci_cc.send(frame)
            self.check_status_and_state(
                results, 'delete-mac-bridge-port-configuration-data')

            # TODO: We need not delete the TCONT as TCONTs are pre-created. We should possibly
            # unset the TCONTs alloc-id from a valid value to 0xffff.
            # But this was not causing issues in my test. A separate Jira is necessary for this.
            yield self._setup__8021p_mapper__ani_mac_bridge_port()

        except TimeoutError as e:
            self.log.warn('rx-timeout-8021p-ani-port-delete', e=e)
            raise

        except Exception as e:
            self.log.exception('omci-setup-8021p-ani-port-delete', e=e)
            raise