> For the complete documentation index, see [llms.txt](https://yeasy.gitbook.io/mininet_book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yeasy.gitbook.io/mininet_book/qi-ta-mo-kuai/cli.md).

# mininet.cli 模块

主要包括 CLI 类，该类继承自 Python 库的 Cmd 类。

提供对 CLI 的支持，创建 Mininet 的 bash，接受通过 bash 传输的 Mininet 命令，形成可以进行交互的 Mininet 命令行环境。

主要方法包括初始化之后提供一个界面，通过 Python 库的 Cmd 类的 cmdloop() 方法不断执行输入的命令。这些命令可以是指定对某个节点进行的操作或者是对 Mininet 对象本身。

对于大部分对 Mininet 对象的操作命令 xxx，会调用 Python 库的 Cmd 类的 onecmd() 方法来执行，该方法会对应调用 do\_xxx 方法。

各个 do\_xxx 方法分别用于执行支持的命令。例如 do\_dpctl() 方法响应用户输入 dpctl 相关命令。目前包括 dpctl，dump，EOF，exit，gterm，help，intfs，iperf，iperfudp，link，net，nodes，noecho，pingall，pingallfull，pingpair，pingparifull，px，py，quit，sh，source，time，x，xterm 等。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://yeasy.gitbook.io/mininet_book/qi-ta-mo-kuai/cli.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
