hpimdm/tree/KernelEntry.py
def network_update(self):
        """
        Router suffered an RPC chage... React to this change
        """
        with self.CHANGE_STATE_LOCK:
            (metric_administrative_distance, metric_cost, is_directly_connected, new_inbound_interface_index) = \
                UnicastRouting.get_unicast_info(self.source_ip)
            new_rpc = Metric(metric_administrative_distance, metric_cost)

            if not is_directly_connected:
                self._tree_state.transition_to_inactive(self)
                return
            if new_inbound_interface_index != self.inbound_interface_index:
                # get old interfaces
                old_upstream_interface = self.interface_state.get(self.inbound_interface_index, None)
                old_downstream_interface = self.interface_state.get(new_inbound_interface_index, None)

                non_root_interest_state = self._interest_interface_state.get(self.inbound_interface_index, False)
                non_root_upstream_state = self._upstream_interface_state.get(self.inbound_interface_index, None)
                root_interest_state = self._interest_interface_state.get(new_inbound_interface_index, False)
                root_upstream_state = self._upstream_interface_state.get(new_inbound_interface_index, None)

                if new_inbound_interface_index is None:
                    self.sat_is_running = False
                    new_tree_state = TreeState.Unsure
                else:
                    new_tree_state = TreeState.Active

                # change type of interfaces
                if self.inbound_interface_index is not None:
                    new_downstream_interface = TreeInterfaceNonRoot(self, self.inbound_interface_index, self._rpc,
                                                                    non_root_upstream_state, non_root_interest_state,
                                                                    was_root=True,
                                                                    previous_tree_state=self._tree_state,
                                                                    current_tree_state=new_tree_state)
                    self.interface_state[self.inbound_interface_index] = new_downstream_interface
                if new_inbound_interface_index is not None:
                    self.sat_is_running = True
                    new_upstream_interface = TreeInterfaceRootOriginator(self, new_inbound_interface_index, new_tree_state)
                    self.interface_state[new_inbound_interface_index] = new_upstream_interface
                self.inbound_interface_index = new_inbound_interface_index

                # remove old interfaces
                if old_upstream_interface is not None:
                    old_upstream_interface.delete()
                if old_downstream_interface is not None:
                    old_downstream_interface.delete()

                self.check_tree_state()
                self.change()
            if self._rpc != new_rpc:
                self._rpc = new_rpc
                for interface in self.interface_state.values():
                    interface.notify_rpc_change(new_rpc)

        Router suffered an RPC chage... React to this change
        
Router suffered an RPC chage... React to this change
Router suffered an RPC chage ... React to this change
def network_update(self):
        with self.CHANGE_STATE_LOCK:
            (metric_administrative_distance, metric_cost, is_directly_connected, new_inbound_interface_index) = \
                UnicastRouting.get_unicast_info(self.source_ip)
            new_rpc = Metric(metric_administrative_distance, metric_cost)
            if not is_directly_connected:
                self._tree_state.transition_to_inactive(self)
                return
            if new_inbound_interface_index != self.inbound_interface_index:
                old_upstream_interface = self.interface_state.get(self.inbound_interface_index, None)
                old_downstream_interface = self.interface_state.get(new_inbound_interface_index, None)
                non_root_interest_state = self._interest_interface_state.get(self.inbound_interface_index, False)
                non_root_upstream_state = self._upstream_interface_state.get(self.inbound_interface_index, None)
                root_interest_state = self._interest_interface_state.get(new_inbound_interface_index, False)
                root_upstream_state = self._upstream_interface_state.get(new_inbound_interface_index, None)
                if new_inbound_interface_index is None:
                    self.sat_is_running = False
                    new_tree_state = TreeState.Unsure
                else:
                    new_tree_state = TreeState.Active
                if self.inbound_interface_index is not None:
                    new_downstream_interface = TreeInterfaceNonRoot(self, self.inbound_interface_index, self._rpc,
                                                                    non_root_upstream_state, non_root_interest_state,
                                                                    was_root=True,
                                                                    previous_tree_state=self._tree_state,
                                                                    current_tree_state=new_tree_state)
                    self.interface_state[self.inbound_interface_index] = new_downstream_interface
                if new_inbound_interface_index is not None:
                    self.sat_is_running = True
                    new_upstream_interface = TreeInterfaceRootOriginator(self, new_inbound_interface_index, new_tree_state)
                    self.interface_state[new_inbound_interface_index] = new_upstream_interface
                self.inbound_interface_index = new_inbound_interface_index
                if old_upstream_interface is not None:
                    old_upstream_interface.delete()
                if old_downstream_interface is not None:
                    old_downstream_interface.delete()
                self.check_tree_state()
                self.change()
            if self._rpc != new_rpc:
                self._rpc = new_rpc
                for interface in self.interface_state.values():
                    interface.notify_rpc_change(new_rpc)
def network_update ( self ) : with self . CHANGE_STATE_LOCK : ( metric_administrative_distance , metric_cost , is_directly_connected , new_inbound_interface_index ) = UnicastRouting . get_unicast_info ( self . source_ip ) new_rpc = Metric ( metric_administrative_distance , metric_cost ) if not is_directly_connected : self . _tree_state . transition_to_inactive ( self ) return if new_inbound_interface_index != self . inbound_interface_index : old_upstream_interface = self . interface_state . get ( self . inbound_interface_index , None ) old_downstream_interface = self . interface_state . get ( new_inbound_interface_index , None ) non_root_interest_state = self . _interest_interface_state . get ( self . inbound_interface_index , False ) non_root_upstream_state = self . _upstream_interface_state . get ( self . inbound_interface_index , None ) root_interest_state = self . _interest_interface_state . get ( new_inbound_interface_index , False ) root_upstream_state = self . _upstream_interface_state . get ( new_inbound_interface_index , None ) if new_inbound_interface_index is None : self . sat_is_running = False new_tree_state = TreeState . Unsure else : new_tree_state = TreeState . Active if self . inbound_interface_index is not None : new_downstream_interface = TreeInterfaceNonRoot ( self , self . inbound_interface_index , self . _rpc , non_root_upstream_state , non_root_interest_state , was_root = True , previous_tree_state = self . _tree_state , current_tree_state = new_tree_state ) self . interface_state [ self . inbound_interface_index ] = new_downstream_interface if new_inbound_interface_index is not None : self . sat_is_running = True new_upstream_interface = TreeInterfaceRootOriginator ( self , new_inbound_interface_index , new_tree_state ) self . interface_state [ new_inbound_interface_index ] = new_upstream_interface self . inbound_interface_index = new_inbound_interface_index if old_upstream_interface is not None : old_upstream_interface . delete ( ) if old_downstream_interface is not None : old_downstream_interface . delete ( ) self . check_tree_state ( ) self . change ( ) if self . _rpc != new_rpc : self . _rpc = new_rpc for interface in self . interface_state . values ( ) : interface . notify_rpc_change ( new_rpc )
Router suffered an RPC chage... React to this change
Router suffered an RPC chage ... React to this change
"""
        Router suffered an RPC chage... React to this change
        """ # get old interfaces # change type of interfaces # remove old interfaces
self