概述
1 nesting结构树
由于doc中没有可参考的使用教程,决定硬啃源码
2 结构树解读
文件名 | 类型 | 内容 | 备注 |
---|---|---|---|
simulations | 存放仿真例子(自己项目的话一般是放配置文件) | ||
src | 节点、链路层等内容定义的源码(自己项目的话一般就是放.ned和.cc和.ini等源码) | ||
doc | 一些介绍性的玩意儿除了linux_gsg.rst有安装介绍以外,其他玩意儿对于目前的我看来没有啥用。 | ||
out | 存放仿真的结果数据输出,release指的是发布版本 | ||
scripts | 存放两脚本 | ||
tests | 一些 .test 文件和 .TODO 文件 | ||
3 simulations > nesting-StandardHost
习惯性从.ned文件开始看起
simulations > nesting-StandardHost > topology.ned(拓扑.ned文件)
topology.ned(拓扑.ned文件)
//包所在位置
package nesting.simulations.nestingStandardHost;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.node.ethernet.Eth1G;
import nesting.node.ethernet.VlanEtherSwitchPreemptable;
import nesting.node.nesting.NestingStandardHost;
//网络定义
network NestingStandardHostSim
{
parameters:
//显示设置
@display("bgb=448.53998,443.62");
//子模块
submodules:
//ipv4网络配置器
configurator: Ipv4NetworkConfigurator {
@display("is=s;p=63,39");
}
//n0-n6 都是nesting的标准节点
n0: NestingStandardHost {
parameters:
@display("p=130.37999,104.96");
gates:
ethg[1];
}
n1: NestingStandardHost {
parameters:
@display("p=75.439995,136.94");
gates:
ethg[1];
}
n2: NestingStandardHost {
parameters:
@display("p=86.92,272.24");
gates:
ethg[1];
}
n3: NestingStandardHost {
parameters:
@display("p=378.84,259.12");
gates:
ethg[1];
}
n4: NestingStandardHost {
parameters:
@display("p=378.84,156.62");
gates:
ethg[1];
}
n5: VlanEtherSwitchPreemptable {
parameters:
@display("p=162.36,205.81999");
gates:
ethg[4];
}
n6: VlanEtherSwitchPreemptable {
parameters:
@display("p=285.36,205.81999");
gates:
ethg[3];
}
connections:
n0.ethg[0] <--> Eth1G <--> n5.ethg[0];
n1.ethg[0] <--> Eth1G <--> n5.ethg[1];
n2.ethg[0] <--> Eth1G <--> n5.ethg[2];
n3.ethg[0] <--> Eth1G <--> n6.ethg[1];
n4.ethg[0] <--> Eth1G <--> n6.ethg[2];
n5.ethg[3] <--> Eth1G <--> n6.ethg[0];
}
ethg[i]
是一个输入输出门,源于LinkLayerNodeBase.ned文件(链路层节点)中的定义:并且带有两标签:@labels(EtherFrame-conn) @allowUnconnected;
: 以太网帧接口和允许没有被连接。
gates:
input radioIn[numWlanInterfaces] @directIn;
inout pppg[numPppInterfaces] @labels(PppFrame-conn) @allowUnconnected;
inout ethg[numEthInterfaces] @labels(EtherFrame-conn) @allowUnconnected;
@display
皆为显示设置,参数不必多管,在Design视图中可以随意拖拽更改。- 节点间的通讯信道定义
Eth1G
源于 EtherLink.ned文件中的信道定义:
//
// 100 gigabit/sec Ethernet link
//
channel Eth100G extends EtherLink {
//传输速率为100Gbps
datarate = 100Gbps;
}
- 第一个模块 configurator ,继承自Ipv4NetworkConfigurator(终于有个好好注释的源文件了:
Ipv4NetworkConfigurator.ned
package inet.networklayer.configurator.ipv4;
import inet.networklayer.configurator.base.NetworkConfiguratorBase;
//该模块为IPv4网络分配IPv4地址,并设置静态路由。
//它按接口分配IP地址,尽量考虑子网,还可以通过合并路由表项来优化生成的路由表。
//重要提示:从INET 2.2开始,这个模块不会直接分配地址或添加路由,只是将它们存储在内部数据结构中。网络节点应该包含一个~ ipv4nodeconfigator实例(通常是网络层复合模块的一部分),该实例根据存储在全局网络配置器模块中的信息实际配置节点的接口表和路由表。
//配置器支持手动和自动地址分配以及它们的组合。您可以提供不指定部分的地址和子网掩码模板,配置器通过尝试将同一LAN中的节点放入同一子网来自动完成它们。它还支持手动路由和遵循最短路径的自动路由。默认情况下,配置器在适用的地方添加默认路由(例如在主机中),并进行基于子网的路由。
//与节点数量相比,只需使用一小部分配置条目就可以建立分层路由。配置器还会对路由表进行优化,以显著减少大型网络中的路由表的大小。
//
// 以上大多数特性都可以使用NED参数打开和关闭。详细信息(接口地址和子网掩码模板、手动路由等)可以在整个网络的单个XML文件中配置。
// 表示网络节点(主机、集线器、总线、交换机、接入点、路由器等)的模块应该具有@ networkknode属性,因为这是配置器在模型中识别它们的方式。所有节点必须将其接口表(~InterfaceTable模块)作为其“InterfaceTable”子模块。
// 所有路由器都必须有它们的路由表(~Ipv4RoutingTable模块)作为它们的“routingTable”或“networkLayer”。routingTable”子模块。
// 默认情况下,所有节点的所有接口都将分配一个唯一的IPv4地址。路由表将被配置为从任何节点到任何接口都有一条遵循最短路径的路由。换句话说,所有接口都可以从所有节点访问(例如ping)。
// 配置器不连接任何其他模块(它没有门),并且在整个模型中应该只有一个实例。配置发生在初始化阶段2,在~InterfaceTable模块中注册接口之后。
//
// 配置器的配置步骤如下:
//
//
-# 构建表示网络拓扑的图。图将为每个具有@ networkknode属性的模块分配一个顶点(这包括主机、路由器和L2设备,如交换机、接入点、以太网集线器等)。它还为在设置路由时将被最短路径算法使用的顶点和边分配权重。对于禁用了IP转发(以防止路由传输它们)的IP节点,权值将是无限的,而对于所有其他节点(路由器和L2设备),权值将为零。选择的边权值与链路的比特率成反比,这样配置者就会优先选择带宽较高的连接。对于内部目的,配置器还构建一个所有“链路”的表(链路数据结构由同一点对点链路或LAN上的一组网络接口组成)
//
//
-# 为所有节点的所有接口分配IP地址。分配过程考虑到接口上已经存在的地址和网掩码(可能在早期初始化阶段设置),以及XML格式提供的配置(如下所述)。配置可以为地址和网掩码指定“模板”,其中的部分是固定的,部分可以由配置器选择(例如。“10.0.x.x”)。在最一般的情况下,配置器被允许为所有接口选择任何地址和网掩码(这导致自动地址分配)。在最受限制的情况下,配置器被迫为所有接口使用请求的地址和网掩码(转换为手动地址分配)。在这两个极端之间有许多可能的配置选项。配置器以一种使每个子网的节点数量最大化的方式分配地址。一旦它找出了属于一个子网的节点,就会优化分配尽可能长的网络掩码。配置器可能无法根据给定的配置参数分配网络掩码和地址;如果发生这种情况,分配过程停止并发出错误信号。
//
//
-# 添加配置中指定的手动路由。
//
//
-# 向网络中所有的路由表添加静态路由。配置器使用Dijkstra的加权最短路径算法在所有可能的节点对之间找到所需的路由。产生的路由表将为网络中的所有目的接口提供一个条目。可以安全地指示配置器在适用的地方添加缺省路由,从而大大减少主机路由表的大小。它还可以增加子网路由而不是接口路由,从而进一步减小路由表的规模。开启这个选项需要仔细设计,以避免在不同的链路上有来自同一子网的IP地址。注意:同时使用手动路由和静态路由生成可能会产生不必要的副作用,因为路由生成忽略了手动路由。
//
//
-# 然后根据大小优化路由表。这种优化允许用更小的内存占用配置更大的网络,并使路由表查找更快。产生的路由表可能不同,因为它将路由原始路由表没有路由的数据包。尽管如此,下列不变式保持不变:由原始路由表路由的任何数据包(有匹配的路由)仍将以相同的方式由优化后的路由表路由。
//
//
-# 最后,它转储配置请求的结果。它可以转储网络拓扑,分配的IP地址,路由表和自己的配置格式。
//
// 下面以配置IPv4地址范围内的所有接口为例
// 10.0.0.0 - 10.255.255.255, and netmask range 255.0.0.0 - 255.255.255.255.
// This is the default configuration.
//10.0.0.0 - 10.255.255.255,子网掩码范围为255.0.0.0 - 255.255.255.255。这是默认配置。
// <pre>
// <config>
//
<interface hosts='**' address='10.x.x.x' netmask='255.x.x.x'/>
// </config>
// </pre>
//
//下面的示例以一种保持路由表较小的方式配置分层网络。
// <pre>
// <config>
//
<interface hosts="area11.lan1.*" address="10.11.1.x" netmask="255.255.255.x"/>
//
<interface hosts="area11.lan2.*" address="10.11.2.x" netmask="255.255.255.x"/>
//
<interface hosts="area12.lan1.*" address="10.12.1.x" netmask="255.255.255.x"/>
//
<interface hosts="area12.lan2.*" address="10.12.2.x" netmask="255.255.255.x"/>
//
<interface hosts="area*.router*" address="10.x.x.x" netmask="x.x.x.x"/>
//
<interface hosts="*" address="10.x.x.x" netmask="255.x.x.0"/>
// </config>
// </pre>
//XML配置必须恰好包含一个<config>元素。</config>在根元素下可以有以下元素的倍数。
//
- <interface>
//
The interface element provides configuration parameters for one or more
//
interfaces in the network. The selector attributes limit the scope where
//
the interface element has effects. The parameter attributes limit the
//
range of assignable addresses and netmasks.
//
//
- @hosts
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces in the specified hosts are affected. The pattern might
//
be a full path starting from the network, or a module name anywhere in
//
the hierarchy, and other patterns similar to ini file keys. The default
//
value is "*" that matches all hosts.
//
e.g. "subnet.client*" or "host* router[0..3]" or "area*.*.host[0]"
//接口元素为网络中的一个或多个接口提供配置参数。选择器属性限制了接口元素的作用域。参数属性限制了可分配地址和网络掩码的范围。
//- @hosts可选的选择属性,指定主机名模式列表。
//只有指定主机的接口受影响。模式可以是从网络开始的完整路径,也可以是层次结构中任意位置的模块名,以及其他类似于ini文件键的模式。系统默认值为“*”,匹配所有主机。如。“子网。客户端*"或"主机*路由器[0..3]”或“区域*。* .host[0]”
//
//
- @names
//
Optional selector attribute that specifies a list of interface name
//
patterns. Only interfaces with the specified names are affected. The
//
default value is "*" that matches all interfaces.
//
e.g. "eth* ppp0" or "*"
//指定接口名称模式列表的可选选择器属性。只有指定名称的接口受影响。缺省值为“*”,匹配所有接口。如。"eth* ppp0"或"*"
//
- @towards
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces connected towards the specified hosts are affected. The
//
specified name will be matched against the names of hosts that are on
//
the same LAN with the one that is being configured. This works even if
//
there's a switch between the configured host and the one specified here.
//
For wired networks it might be easier to specify this parameter instead
//
of specifying the interface names. The default value is "*".
//
e.g. "ap" or "server" or "client*"
//指定主机名模式列表的可选选择器属性。只有连接到指定主机的接口受影响。指定的名称将与正在配置的主机在同一局域网内的主机名称进行匹配。即使在配置的主机和这里指定的主机之间有一个切换,这也可以工作。对于有线网络,指定这个参数可能比指定接口名称更容易。系统默认值为“*”。如。"ap"或"服务器"或"客户端*"
//
- @among
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces in the specified hosts connected towards the specified
//
hosts are affected.
//
The 'among="X Y Z"' is same as 'hosts="X Y Z" towards="X Y Z"'.
//指定主机名模式列表的可选选择器属性。只有连接到指定主机的指定主机上的接口受到影响。'among="X Y Z"'与'hosts="X Y Z" towards="X Y Z"'相同。
//
- @address
//
Optional parameter attribute that limits the range of assignable
//
addresses. Wildcards are allowed with using 'x' as part of the address
//
in place of a byte. Unspecified parts will be filled automatically be
//
the configurator. The default value "" means that the address will not
//
be configured. Unconfigured interfaces still have allocated addresses
//
in their subnets allowing them to become configured later very easily.
//
e.g. "192.168.1.1" or "10.0.x.x"
//限制可分配地址范围的可选参数属性。通配符允许使用'x'作为地址的一部分来代替一个字节。未指定的部分将自动作为配置器填充。默认值为“”,表示不配置。未配置的接口仍然在其子网中分配地址,允许以后非常容易地配置它们。如。“192.168.1.1”或“10.0.x.x”
//
- @netmask
//
Optional parameter attribute that limits the range of assignable
//
netmasks. Wildcards are allowed with using 'x' as part of the netmask
//
in place of a byte. Unspecified parts will be filled automatically be
//
the configurator. The default value "" means that any netmask can be
//
configured.
//
e.g. "255.255.255.0" or "255.255.x.x" or "255.255.x.0"
//限制可分配网络掩码范围的可选参数属性。通配符允许使用'x'作为netmask的一部分来代替一个字节。未指定的部分将自动由配置器填充。默认值“”表示可以配置任何网络掩码。如。“255.255.255.0”或“255.255.x。x”或“255.255.x.0”
//
- @mtu
number
//
Optional parameter attribute to set the MTU parameter in the interface.
//
When unspecified the interface parameter is left unchanged.
//可选参数attribute设置接口的MTU参数。当未指定接口参数时,保持不变。
//
- @metric
number
//
Optional parameter attribute to set the Metric parameter in the interface.
//
When unspecified the interface parameter is left unchanged.
//可选parameter attribute配置接口Metric参数。当未指定接口参数时,保持不变。
//
- @groups
//
Optional parameter attribute; it may contain a list of (multicast)
//
IP addresses that will be added to the multicast groups of the interface.
//
See also the <multicast-group> element.
//可选参数属性;它可以包含一个(组播)IP地址列表,这些IP地址将被添加到接口的组播组中。请参见<multicast-group>元素。</multicast-group>
//
- @add-static-route
//
Optional bool parameter (default=true).
//
Add static route to the routing table.
//可选bool参数(default=true)。在路由表中添加静态路由。
//
- @add-default-route
//
Optional bool parameter (default=true).
//
Add default route to the routing table if the node has only one non-loopback interface.
//当节点只有一个非环回接口时,需要在路由表中添加缺省路由。
//
- @add-subnet-route
//
Optional bool parameter (default=true).
//
Add subnet route to the routing table.
//
//
- <wireless>
//
The wireless element specifies the members of a wireless network. It is
//
primarily useful when the members cannot be automatically determined using
//
the SSID parameters.
//
//
- @id (optional)
//
identifies wireless network, unique value used if missed
//
//
- @hosts
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces in the specified hosts are affected. The default value
//
is "*" that matches all hosts.
//
//
- @interfaces
//
Optional selector attribute that specifies a list of interface name
//
patterns. Only interfaces with the specified names are affected. The
//
default value is "*" that matches all interfaces.
//
//
- <multicast-group>
//
The multicast group element provides multicast network addresses for one
//
or more interfaces in the network.
//
//
- @hosts
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces in the specified hosts are affected. The default value
//
is "*" that matches all hosts.
//
//
- @interfaces
//
Optional selector attribute that specifies a list of interface name
//
patterns. Only interfaces with the specified names are affected. The
//
default value is "*" that matches all interfaces.
//
//
- @towards
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces connected towards the specified hosts are affected.
//
The default value is "*".
//
//
- @among
//
Optional selector attribute that specifies a list of host name patterns.
//
Only interfaces in the specified hosts connected towards the specified
//
hosts are affected.
//
The 'among="X Y Z"' is same as 'hosts="X Y Z" towards="X Y Z"'.
//
//
- @address
//
Mandatory parameter attribute that specifies a list of multicast group
//
addresses to be assigned. Values must be selected from the valid range
//
of multicast addresses.
//
e.g. "224.0.0.1 224.0.1.33"
//
//
- <route>
//
The route element provides routing table entries for multiple nodes
//
in the network. The selector attributes limit the scope where the route
//
element has effects.
//
//
- @hosts
//
Optional selector attribute that specifies a list of host name patterns.
//
Only routing tables in the specified hosts are affected. The default
//
value "" means all hosts will be affected.
//
e.g. "host* router[0..3]"
//
//
- @destination
//
Optional parameter attribute that specifies the destination address in
//
the route (L3AddressResolver syntax). The default value is "*".
//
e.g. "192.168.1.1" or "subnet.client[3]" or "subnet.server(ipv4)" or "*"
//
//
- @netmask
//
Optional parameter attribute that specifies the netmask in the route.
//
The default value is "*".
//
e.g. "255.255.255.0" or "/29" or "*"
//
//
- @gateway
//
Optional parameter attribute that specifies the gateway (next-hop)
//
address in the route (L3AddressResolver syntax). When unspecified
//
the interface parameter must be specified. The default value is "*".
//
e.g. "192.168.1.254" or "subnet.router" or "*"
//
//
- @interface
//
Optional parameter attribute that specifies the output interface name
//
in the route. When unspecified the gateway parameter must be specified.
//
This parameter has no default value.
//
e.g. "eth0"
//
//
- @metric
//
Optional parameter attribute that specifies the metric in the route.
//
The default value is 0.
//
//
- <multicast-route>
//
The multicast-route elements add entries to multicast routing tables.
//
//
- @hosts
//
Optional selector attribute that specifies a list of host name patterns.
//
Only routing tables in the specified hosts are affected.
//
e.g. "host* router[0..3]"
//
//
- @source
//
Optional parameter attribute that specifies the address of the source
//
network. The default value is "*" that matches all sources.
//
//
- @netmask
//
Optional parameter attribute that specifies the netmask of the source
//
network. The default value is "*" that matches all sources.
//
//
- @groups
//
Optional List of IPv4 multicast addresses specifying the groups this entry
//
applies to. The default value is "*" that matches all multicast groups.
//
e.g. "225.0.0.1 225.0.1.2".
//
//
- @metric
//
Optional parameter attribute that specifies the metric in the route.
//
//
- @parent
//
Optional parameter attribute that specifies the name of the interface
//
the multicast datagrams are expected to arrive. When a datagram arrives
//
on the parent interface, it will be forwarded towards the child interfaces;
//
otherwise it will be dropped. The default value is the interface on the
//
shortest path towards the source of the datagram.
//
//
- @children
//
Mandatory parameter attribute that specifies a list of interface name
//
patterns:
//
- a name pattern (e.g. "ppp*") matches the name of the interface
//
- a 'towards' pattern (starting with ">", e.g. ">router*") matches the interface
//
by naming one of the neighbour nodes on its link.
//
Incoming multicast datagrams are forwarded to each child interface except the
//
one they arrived in.
//
//
- <autoroute>
//
The autoroute element specifies parameters for the automatic static routing.
//
If this element is not specified then the configurator assumes a default.
//
The default specifies that all routing tables will be modified and all the
//
shortest path to all interfaces will be computed.
//
//
- @sourceHosts
//
Optional selector attribute that specifies a list of host full path patterns.
//
It determines the set of routing tables that will be modified. The default
//
value is "**".
//
//
- @destinationInterfaces
//
Optional parameter attribute that specifies a list of interface full path
//
patterns. It determines the set of destination interfaces for which the
//
shortest path will be computed. The default value is "**".
//
//
- @metric
//
Optional parameter attribute that determines the metric that is used to
//
compute the shortest paths. Valid values are: "hopCount", "delay", "dataRate",
//
and "errorRate". The default value is "hopCount".
//
//
- <node>
//
The node optional subelement specifies cost parameters for the shortest
//
path algorithm. If this subelement is not specified then the configurator
//
determines cost by default according to the selected metric.
//
//
- @hosts
//
Mandatory selector attribute that specifies a list of node full path
//
patterns. It determines the affected set of nodes.
//
//
- @cost
//
Mandatory parameter attribute that specifies the cost. Valid values are
//
"infinite" and numbers.
//
//
- <link>
//
The node subelement specifies cost parameters for the shortest path algorithm.
//
If this subelement is not specified then the configurator determines link
//
cost by default according to the selected metric.
//
//
- @interfaces
//
Mandatory selector attribute that specifies a list of interface full
//
path patterns. It determines the affected set of links connected to
//
the given interfaces.
//
//
- @cost
//
Mandatory parameter attribute that specifies the cost. Valid values are
//
"infinite" and numbers.
//
simple Ipv4NetworkConfigurator extends NetworkConfiguratorBase
{
parameters:
@class(Ipv4NetworkConfigurator);
@display("i=block/cogwheel");
xml config = default(xml("<config><interface hosts='**' address='10.x.x.x' netmask='255.x.x.x'/></config>")); // XML configuration parameters for IP address assignment and adding manual routes
bool assignAddresses = default(true); // assign IP addresses to all interfaces in the network
bool assignDisjunctSubnetAddresses = default(true); // avoid using the same address prefix and netmask on different links when assigning IP addresses to interfaces
bool addStaticRoutes = default(true);
// add static routes to the routing tables of all nodes to route to all destination interfaces (only where applicable; turn off when config file contains manual routes)
bool addDefaultRoutes = default(true); // add default routes if all routes from a source node go through the same gateway (used only if addStaticRoutes is true)
bool addSubnetRoutes = default(true);
// add subnet routes instead of destination interface routes (only where applicable; used only if addStaticRoutes is true)
bool addDirectRoutes = default(true);
// add direct routes (i.e. directly connected interfaces) to the routing table (used only if addStaticRoutes is true)
bool optimizeRoutes = default(true); // optimize routing tables by merging routes, the resulting routing table might route more packets than the original (used only if addStaticRoutes is true)
bool dumpTopology = default(false);
// print extracted network topology to the module output
bool dumpLinks = default(false);
// print recognized network links to the module output
bool dumpAddresses = default(false); // print assigned IP addresses for all interfaces to the module output
bool dumpRoutes = default(false);
// print configured and optimized routing tables for all nodes to the module output
string dumpConfig = default("");
// write configuration into the given config file that can be fed back to speed up subsequent runs (network configurations)
}
最终便是一个这样的拓扑结构:2个交换机,5个标准host节点:
config.xml
同级目录下的文件:
<config>
<interface hosts="**" address="10.x.x.x" netmask="255.x.x.x"/>
<multicast-group hosts="n3" address="224.0.0.0"/>
<multicast-group hosts="n0" address="224.0.0.1"/>
<multicast-group hosts="n4" address="224.0.0.2"/>
<multicast-group hosts="n2" address="224.0.0.3"/>
</config>
- interface 对所有的 hosts 的地址和子网掩码进行了配置
- 为n0,2,3,4 节点配置地址(为什么没有n1?)
routing.xml
<filteringDatabases>
<filteringDatabase id="n5">
<static>
<forward>
<multicastAddress ports="0" macAddress="01:00:5e:00:00:01"/>
<multicastAddress ports="2" macAddress="01:00:5e:00:00:03"/>
<multicastAddress ports="3" macAddress="01:00:5e:00:00:00"/>
<multicastAddress ports="3" macAddress="01:00:5e:00:00:02"/>
</forward>
</static>
</filteringDatabase>
<filteringDatabase id="n6">
<static>
<forward>
<multicastAddress ports="0" macAddress="01:00:5e:00:00:01"/>
<multicastAddress ports="0" macAddress="01:00:5e:00:00:03"/>
<multicastAddress ports="1" macAddress="01:00:5e:00:00:00"/>
<multicastAddress ports="2" macAddress="01:00:5e:00:00:02"/>
</forward>
</static>
</filteringDatabase>
</filteringDatabases>
对交换机节点 n5 和 n6 的端口和Mac地址进行配置
shedules.xml
<stream id="0">
<datagramSchedule baseTime="0ns" cycleTime="1000000ns">
<event payloadSize="236B" destAddress="224.0.0.0" destPort="8" pcp="7" timeInterval="1000000ns"/>
</datagramSchedule>
</stream>
<stream id="1">
<datagramSchedule baseTime="0ns" cycleTime="1000000ns">
<event payloadSize="236B" destAddress="224.0.0.2" destPort="24" pcp="7" timeInterval="1000000ns"/>
</datagramSchedule>
</stream>
这应该是调度表的配置文件。
- 里头定义了stream 0 和 1 ,应该是数据流,因为TSN是采用流表(数据流)。定义了周期时间,目的地、端口、间隔时间等参数。
<switch name="n5">
<port id="3">
<schedule baseTime="0ns" cycleTime="1000000ns">
<entry>
<length>5000ns</length>
<bitvector>11111110</bitvector>
</entry>
<entry>
<length>5000ns</length>
<bitvector>00000001</bitvector>
</entry>
<entry>
<length>990000ns</length>
<bitvector>11111110</bitvector>
</entry>
</schedule>
</port>
</switch>
- 对于交换机节点n5 配置了端口3的调度表。节点n6同理
omnetpp.ini
此拓扑的启动时初始化参数配置。
[General]
outputvectormanager-class="omnetpp::envir::SqliteOutputVectorManager"
outputscalarmanager-class="omnetpp::envir::SqliteOutputScalarManager"
#网络拓扑:topology.ned
network = NestingStandardHostSim
check-signals = true
record-eventlog = false
debug-on-errors = true
result-dir = result_dir
#输出向量文件
output-vector-file = result_dir/robotController2_vec.sqlite
#输出标量文件
output-scalar-file = result_dir/robotController2_sca.sqlite
sim-time-limit = 0.1s
# IPv4 network configurator
**.configurator.config = xmldoc("config.xml")
# Disable all unecessary recordings
**.scalar-recording = false
**.eth.queuing.**.vector-recording = false
**.eth.etherEncapE.**.vector-recording = false
**.eth.etherEncapP.**.vector-recording = false
**.eth.frameForward.**.vector-recording = false
**.eth.vlanEncapE.**.vector-recording = false
**.eth.vlanEncapP.**.vector-recording = false
**.eth[*].etherEncapE.**.vector-recording = false
**.eth[*].etherEncapP.**.vector-recording = false
**.eth[*].frameForward.**.vector-recording = false
**.eth[*].queuing.gateController.**.vector-recording = false
# **.eth[*].queuing.queues[*].**.vector-recording = true
**.eth[*].queuing.queuingFrames.**.vector-recording = false
**.eth[*].queuing.transmissionSelection.**.vector-recording = false
**.eth[*].queuing.tsAlgorithms[*].**.vector-recording = false
**.eth[*].vlanEncapE.**.vector-recording = false
**.eth[*].vlanEncapP.**.vector-recording = false
**.processingDelay.vector-recording = false
**.processingDelay[*].**.vector-recording = false
# **.trafGenSchedApp.**.vector-recording = false
# Enable required recordings
# enqueuePK
**.eth[*].queuing.**.vector-recording = true
**.eth[*].queuing.queues[7].**.vector-recording = true
# startTxExpressFrame, receivedExpressFrame
**.mac.**.vector-recording = true
# txExpressFrame (Switches)
**.eth[*].mac.**.vector-recording = true
**.trafGenSchedApp.**.vector-recording = true
# Debug
**.displayAddresses = true
**.verbose = true
**.promiscuous = true
**.oscillator.frequency = 1GHz
# MAC Addresses
**.n0.eth.address = "00:00:00:00:00:01"
**.n1.eth.address = "00:00:00:00:00:02"
**.n2.eth.address = "00:00:00:00:00:03"
**.n3.eth.address = "00:00:00:00:00:04"
**.n4.eth.address = "00:00:00:00:00:05"
# Switches
**.n5.processingDelay.delay = 2000ns
**.n6.processingDelay.delay = 2000ns
**.filteringDatabase.database = xmldoc("routing.xml", "/filteringDatabases/")
**.filteringDatabase.cycle = xmldoc("routing.xml", "/schedule/")
**.gateController.enableHoldAndRelease = false
**.eth[*].queuing.tsAlgorithms[0].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[1].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[2].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[3].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[4].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[5].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[6].typename = "StrictPriority"
**.eth[*].queuing.tsAlgorithms[7].typename = "StrictPriority"
# Buffer capacity of queues
**.queues[*].bufferCapacity = 363360b
# Set switches to enable preemption
# Schedule/Routing Swap
**.n5.eth[3].queue.gateController.initialSchedule = xmldoc("schedules.xml", "/schedule/switch[@name='n5']/port[@id='3']/schedule")
**.n6.eth[1].queue.gateController.initialSchedule = xmldoc("schedules.xml", "/schedule/switch[@name='n6']/port[@id='1']/schedule")
**.n6.eth[2].queue.gateController.initialSchedule = xmldoc("schedules.xml", "/schedule/switch[@name='n6']/port[@id='2']/schedule")
# Streams
**.n0.numApps = 1
# Cyclic scheduled traffic (Stream #0)
**.n0.app[0].typename = "UdpScheduledTrafficApp"
**.n0.app[0].trafficGenerator.localPort = 8
**.n0.app[0].scheduleManager.initialAdminSchedule = xmldoc("schedules.xml", "/schedule/stream[@id='0']/datagramSchedule")
**.n1.numApps = 1
# Best effort traffic (Stream #1)
**.n1.app[0].typename = "AppVlanWrapper"
**.n1.app[0].vlanRequester.pcp = 3
**.n1.app[0].app.typename = "UdpBasicApp"
**.n1.app[0].app.localPort = 16
**.n1.app[0].app.destPort = 16
**.n1.app[0].app.destAddresses = "224.0.0.2"
**.n1.app[0].app.sendInterval = 300000ns
**.n1.app[0].app.dontFragment = true
**.n1.app[0].app.messageLength = 1kB
**.n1.app[0].app.packetName = "UdpBestEffortTraffic"
**.n2.numApps = 1
# Cyclic scheduled traffic (Stream #2)
**.n2.app[0].typename = "UdpScheduledTrafficApp"
**.n2.app[0].trafficGenerator.localPort = 24
**.n2.app[0].scheduleManager.initialAdminSchedule = xmldoc("schedules.xml", "/schedule/stream[@id='1']/datagramSchedule")
**.n3.numApps = 1
# Cyclic scheduled traffic (Stream #0)
**.n3.app[0].typename = "UdpSink"
**.n3.app[0].localPort = 8
**.n4.numApps = 2
# Best effort traffic (Stream #1)
**.n4.app[0].typename = "UdpSink"
**.n4.app[0].localPort = 16
# Cyclic scheduled traffic (Stream #2)
**.n4.app[1].typename = "UdpSink"
**.n4.app[1].localPort = 24
# Misc Config
参考:
http://www.manongjc.com/detail/23-jhknavoyamlfodr.html
最后
以上就是自由麦片为你收集整理的(一)nesting解读simulations>nesting-StantardHost的全部内容,希望文章能够帮你解决(一)nesting解读simulations>nesting-StantardHost所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复