python - python 中网络拓扑的表示

标签 python networking switch-statement ethernet openflow

这是来自 https://github.com/osrg/ryu/blob/master/ryu/topology/switches.py#L429 的类 Switches 代码

我在 Switches 类中特别感兴趣的成员变量如下。

    self.dps = {}                 # datapath_id => Datapath class
    self.port_state = {}          # datapath_id => ports
    self.ports = PortDataState()  # Port class -> PortData class
    self.links = LinkState()      # Link class -> timestamp
    self.is_active = True

这些是 RYU 用于缓存拓扑详细信息的成员变量。我正在尝试弄清楚如何使用以下变量来表示拓扑。

1) dps 是一个将 datapath_id 映射到 datapath 类的字典?

- Can someone explain to me what is a datapath_id and a datapath class?

2) port_state 是一个字典,它将数据路径 ID 映射到端口

- As per my understanding on a switch without a VLAN all the ports will belong to the           same datapath id? In case of a switch with VLAN ports on the switch can have multiple datapath id's. Is my understanding correct?

3) ports 又是一个将 Port 类映射到 PortData 类的字典?

- what does this mean?

4) links 又是一个字典,它将 Link 类映射到时间戳

- again what does this mean?

我正在尝试了解 RYU Controller 如何使用上述结构存储拓扑信息。任何理解或解释方面的帮助将不胜感激。

最佳答案

一般来说,每个 OpenFlow 交换机都连接到特定端口上的 Controller ,交换机和 Controller 之间的每个此类连接都被视为单独的“数据路径”,通常称为 DPID(数据路径 ID)。

链路被视为属于 2 个 DPID 的端口之间的连接,因此 DPID 1 (PORT1) <—> (PORT2)DPID2 是 SW1 P1 和 SW2 P1 之间的链接。

我使用 POX Controller ,所以对 Ryu 的了解不多,但我想你现在可以理解它了。

关于python - python 中网络拓扑的表示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23209356/

相关文章:

python - 抓取亚马逊上的订单值(value),添加到相关抓取的产品中

python - LUIS.ai json 迁移到 Rasa 格式 json 不返回实体,但返回正确的意图

python - 多重继承/虚函数

C++ Socks5 通信问题

Datagridview 单元格的 C# Switch-case 循环

python - Paster 守护进程不会关闭,因为无法读取自己的 pid 文件

networking - Clojure:替代使用互斥锁/锁和计数器

c++ - 使用 C/C++ 设置 Linux IP

c - 混合开关和 while 在 C 中

java - Monty Hall 让我们做一笔交易 用 java 模拟(10000 次迭代)