OMNeT ++ openflow无线

时间:2015-07-04 20:52:00

标签: wireless omnet++ openflow

我试图将无线卡集成到openflow交换机中(我想用openflow模拟vanet,所以我需要无线通信) 这是交换机的代码

package openflow.nodes;

import openflow.*;
import inet.linklayer.ieee80211.Ieee80211Nic;

module Wireless_Openflow_switch extends Open_Flow_Switch
{
    parameters:
        int numRadios = default(10);               // the number of radios in the access point

    submodules:
        wlan[numRadios]: Ieee80211Nic{
            mgmtType="Ieee80211MgmtAP";
        }
}

我还创建了一个测试它的场景,这里是代码:

package openflow.scenarios;

import inet.nodes.ethernet.EtherSwitch;
import inet.nodes.inet.Router;
import inet.nodes.inet.StandardHost;
import inet.networklayer.autorouting.ipv4.FlatNetworkConfigurator;
import openflow.nodes.Open_Flow_Controller;
import openflow.nodes.Wireless_Openflow_switch;
import inet.util.ThruputMeteringChannel;
import inet.networklayer.autorouting.ipv4.IPv4NetworkConfigurator;
import inet.nodes.inet.AdhocHost;
import inet.world.radio.ChannelControl;


network test

{
    @display("bgb=780,513");
    types:
        channel ethernetline extends ThruputMeteringChannel
        {
            delay = 1us;
            datarate = 100Mbps;
            thruputDisplayFormat = "u";
        }
    submodules:
        wofs1 : Wireless_Openflow_switch
        {
            @display("p=537,306");
        }

        wofs2 : Wireless_Openflow_switch
        {
            @display("p=537,366");
        }
        wofs3 : Wireless_Openflow_switch
        {
            @display("p=437,366");
        }
        wofs4 : Wireless_Openflow_switch
        {
            @display("p=337,366");
        }
        host1 : AdhocHost
        {
            @display("p=200,306");
        }
        host2 : AdhocHost
        {
            @display("p=250,380");
        }
        host3 : AdhocHost
        {
            @display("p=500,125");
        }
        channelControl: ChannelControl {
            parameters:
                @display("p=60,50");
        }
        configurator: IPv4NetworkConfigurator {
            config=xml("<config><interface hosts='*' address='192.168.1.x' netmask='255.255.255.0'/></config>");
            @display("p=140,50");
    }
        controller: Open_Flow_Controller {
            @display("p=338,167");
        }


        connections allowunconnected:
            controller.ethg++ <--> ethernetline <--> wofs1.gate_controller++;
            controller.ethg++ <--> ethernetline <--> wofs2.gate_controller++;
            controller.ethg++ <--> ethernetline <--> wofs3.gate_controller++;
            controller.ethg++ <--> ethernetline <--> wofs4.gate_controller++;
            wofs1.ethg++ <--> ethernetline <--> wofs2.ethg++;
            wofs1.ethg++ <--> ethernetline <--> wofs3.ethg++;
            wofs1.ethg++ <--> ethernetline <--> wofs4.ethg++;
            wofs2.ethg++ <--> ethernetline <--> wofs3.ethg++;
            wofs2.ethg++ <--> ethernetline <--> wofs4.ethg++;
            wofs4.ethg++ <--> ethernetline <--> wofs3.ethg++;
}

最后这里是配置代码:

[General]
network = test
#record-eventlog = true

num-rngs = 3
**.mobility.rng-0 = 1
**.wlan[*].mac.rng-0 = 2

**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.constraintAreaMaxX = 600m
**.constraintAreaMaxY = 400m
**.constraintAreaMaxZ = 0m
**.debug = true
**.coreDebug = false
**.host*.**.channelNumber = 0

# channel physical parameters
*.channelControl.carrierFrequency = 2.4GHz
*.channelControl.pMax = 25.0mW
*.channelControl.sat = -110dBm
*.channelControl.alpha = 2
*.channelControl.numChannels = 1

# tcp apps
**.numTcpApps = 1
**.host*.tcpApp[0].typename = "TCPSessionApp"
**.host*.tcpApp[0].active = true
**.host*.tcpApp[0].localPort = -1
**.host*.tcpApp[0].connectAddress = "server1"
**.host*.tcpApp[0].connectPort = 1000
**.host*.tcpApp[0].tOpen = 2s
**.host*.tcpApp[0].tSend = 2s
**.host*.tcpApp[0].sendBytes = 3000000B
**.host*.tcpApp[0].sendScript = ""
**.host*.tcpApp[0].tClose = 100s


# mobility
**.host*.mobilityType = "MassMobility"
**.host*.mobility.initFromDisplayString = false
**.host*.mobility.changeInterval = truncnormal(2s, 0.5s)
**.host*.mobility.changeAngleBy = normal(0deg, 30deg)
**.host*.mobility.speed = truncnormal(20mps, 8mps)
**.host*.mobility.updateInterval = 100ms

# ping app (host[0] pinged by others)
**.pingApp[0].startTime = uniform(1s,5s)
**.pingApp[1].startTime = 5s+uniform(1s,5s)
**.pingApp[*].printPing = true

[Config Ping1]
description = "host1 pinging host2"

#openflow
**.controller.ofa_controller.port = 6633
**.controller.behavior = "Forwarding"

**.ofa_switch.connectPort = 6633
**.ofa_switch.connectAddress = "controller"
**.buffer.capacity = 10
**.ofa_switch.flow_timeout = 5s
**.wofs*.etherMAC[*].promiscuous = true

# NIC configuration
**.ppp[*].queueType = "FIFOQueue" # in routers


**.wofs*.tcp.mss = 800
**.controller.tcp.mss = 800

当我运行此代码时,它给了我这个错误:  网络初始化期间模块(IPv4NetworkConfigurator)test.configurator(id = 10)出错:无法找到地址前缀(使用192.168.1.0,指定位255.255.255.0)和网络掩码(长度从24位到24位)进行接口测试。 wofs2.eth0和另外1个接口。请优化您的参数,然后重试!。

网络掩码和地址前缀的正确值是什么? 提前谢谢。

0 个答案:

没有答案