0
我有一個大約20個節點的網絡。每個節點都是一個compund模塊,它有一個基於StandardHost的節點和一個OSPFRouter(其中路由器在內部連接到模塊)。所有這些節點都以隨機順序連接。現在爲每個模塊中的路由器寫一個配置文件。所以我有一個配置文件,每個節點有不同的網絡地址(每個節點代表不同的區域)。現在寫這樣的配置文件變得非常冗長。例如檢查下面的代碼:Omnetpp Config for ned
config = xml("<config>"+
"<interface among='sic0.*' address='192.168.21.x' netmask='255.255.255.x' />"+
"<interface among='sic1.*' address='192.168.22.x' netmask='255.255.255.x' />"+
"<interface among='sic3.*' address='192.168.23.x' netmask='255.255.255.x' />"+
"<interface among='sic4.*' address='192.168.24.x' netmask='255.255.255.x' />"+
.
.
.
.
"<route hosts='sic*.R*' destination='*' netmask='0.0.0.0' interface='eth0' />"+
"</config>");
因爲我有20個節點,這個文件變得很長。 所以我想知道是否有一種方法來抽象並使xml配置參數變小? 謝謝。