Exemplo n.º 1
0
    def stop(self):
        '''
        Stop the BGP process.
        '''

        self.set_stopping()

        self.logger.info("stopping BGP process")

        if not self.dry_run:
            util.pid_kill(pid_file=self.bird_pid)
            util.pid_kill(pid_file=self.bird6_pid)

        self.logger.debug("removing BIRD control socket directory")
        if not self.dry_run:
            util.directory_remove(self.bird_ctl_dir)

        self.logger.debug("removing BIRD configuration directory")
        if not self.dry_run:
            util.directory_remove(self.bird_conf_dir)

        self.logger.debug("removing BIRD logging directory")
        if not self.dry_run:
            util.directory_remove(self.bird_log_dir)

        self.logger.debug("removing BIRD PID file directory")
        if not self.dry_run:
            util.directory_remove(self.bird_pid_dir)

        self.logger.info("finished stopping BGP process")

        self.set_stopped()
Exemplo n.º 2
0
    def stop(self):
        '''
        Stop the daemon.
        '''

        try:
            self.set_stopping()

            self.ipsec_process.stop()
            self.ipsec_process.remove()
        except Exception as e:
            if self.logger.is_running():
                self.logger.exception(e)
            raise

        for o in reversed(self.sorted_overlays):
            try:
                o.stop()
            except Exception as e:
                if o.logger.is_running():
                    o.logger.exception(e)
                raise

            try:
                o.remove()
            except Exception as e:
                if self.logger.is_running():
                    self.logger.exception(e)
                raise

        try:
            self.logger.debug("removing lib dir '%s'" % self.lib_dir)
            util.directory_remove(self.lib_dir)

            self.set_stopped()
        except Exception as e:
            if self.logger.is_running():
                self.logger.exception(e)
            raise
Exemplo n.º 3
0
    def stop(self):
        '''
        Stop the overlay.
        '''

        if not self.enabled:
            return

        self.set_stopping()

        self.logger.info("stopping overlay")

        # Restart the overlay's network namespace object, after
        # shutting it down to conserve memory.
        self.netns.start()

        self.bgp_process.stop()

        for interface in self.interfaces:
            interface.stop()
            interface.remove()

        for mt in self.mesh_tunnels:
            mt.stop()
            mt.remove()

        # We're done with the overlay network namespace. Stop it,
        # and remove the namespace.
        self.netns.stop()
        self.netns.remove()

        self.logger.debug("removing overlay root directory")
        util.directory_remove(self.root_dir)

        self.logger.info("finished stopping overlay")

        self.set_stopped()
Exemplo n.º 4
0
        def tearDown(self):
            """
            Tear down the unit test runtime state.
            """

            util.directory_remove(self.tmp_dir)