Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug occurs when the TsnSwitch uses the ExtLowerEthernetInterface #847

Open
deepsea52418 opened this issue Jan 4, 2023 · 3 comments
Open
Assignees
Labels
Milestone

Comments

@deepsea52418
Copy link

I hope to transmit the real stream to the TSN network, such as UDP packets, to realize the TSN emulation. However, I encountered a BUG when configuring the ExtLowerEthernetInterface for the TsnSwitch.

Gate 'phys$i' of compound module (inet::ExtInterface)DumbbellNetwork.switch1.eth[0] is not connected on the inside, upon arrival of message (inet::physicallayer::Signal)best effort-0 -- in module (inet::PacketTransmitter) DumbbellNetwork.client1.eth[0].phyLayer.transmitter (id=133), at t=0s, event #14

I don't know how to configure to solve this problem.

Here is my network topology. I use 3 virtual machines, two of which act as the real sender and receiver, and the remaining one runs omnetpp.

Hers is my ned file.

//
// SPDX-License-Identifier: LGPL-3.0-or-later
//


package inet.showcases.tsn.My_workspace.nedfile;

import inet.networks.base.TsnNetworkBase;
import inet.node.contract.IEthernetNetworkNode;
import inet.node.ethernet.EthernetLink;

network DumbbellNetwork extends TsnNetworkBase
{
    parameters:
        *.eth[*].bitrate = default(100Mbps);
    submodules:
        client1: <default("TsnDevice")> like IEthernetNetworkNode {
            @display("p=300,150");
            gates:
                ethg[1];
        }
        switch1: <default("TsnSwitch")> like IEthernetNetworkNode {
            @display("p=500,250");
            gates:
                ethg[2];
        }
        switch2: <default("TsnSwitch")> like IEthernetNetworkNode {
            @display("p=700,250");
            gates:
                ethg[2];
        }
        server1: <default("TsnDevice")> like IEthernetNetworkNode {
            @display("p=900,150");
            gates:
                ethg[1];
        }
    connections:
        client1.ethg[0] <--> EthernetLink <--> switch1.ethg[0];
        switch2.ethg[1] <--> EthernetLink <--> server1.ethg[0];
        switch1.ethg[1] <--> EthernetLink <--> switch2.ethg[0];
}

Here is my ini file.

[General]
scheduler-class = "inet::RealTimeScheduler"
network = inet.showcases.tsn.My_workspace.nedfile.DumbbellNetwork
description = "TSN HIL"
**.fcsMode = "computed"  
**.crcMode = "computed"
sim-time-limit = 600s


**.displayGateSchedules = true
**.gateFilter = "**.eth[1].**"
**.gateScheduleVisualizer.height = 16
**.gateScheduleVisualizer.placementHint = "top"


*.client1.numApps = 2
*.client1.app[*].typename = "UdpSourceApp"
*.client1.app[0].display-name = "best effort"
*.client1.app[1].display-name = "video"
*.client1.app[*].io.destAddress = "server1"
*.client1.app[0].io.destPort = 1000
*.client1.app[1].io.destPort = 1001
*.client1.app[*].source.packetLength = 1000B - 54B # 42B = 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) + 8B (ETH PHY)
*.client1.app[0].source.productionInterval = exponential(200us) # ~40Mbps
*.client1.app[1].source.productionInterval = exponential(400us) # ~20Mbps

*.client1.hasOutgoingStreams = true

*.client1.bridging.streamIdentifier.identifier.mapping = [{stream: "best effort", packetFilter: expr(udp.destPort == 1000)},
                                                         {stream: "video", packetFilter: expr(udp.destPort == 1001)}]
*.client1.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0},
                                                 {stream: "video", pcp: 4}]


*.server1.numApps = 2
*.server1.app[*].typename = "UdpSinkApp"
*.server1.app[0].io.localPort = 1000
*.server1.app[1].io.localPort = 1001
*.server1.hasIncomingStreams = true


**.numPcapRecorders = 1
**.client1.pcapRecorder[0].pcapFile = "results/client1.pcap"
**.server1.pcapRecorder[0].pcapFile = "results/server1.pcap"
**.switch1.pcapRecorder[0].pcapFile = "results/switch1.pcap"
**.switch2.pcapRecorder[0].pcapFile = "results/switch2.pcap"

**.forwarding = false



*.switch1.typename = "TsnSwitch1"
*.switch2.typename = "TsnSwitch2"
*.switch*.hasIncomingStreams = true
*.switch*.hasOutgoingStreams = true
*.switch*.bridging.streamCoder.decoder.mapping = [{pcp: 0, stream: "best effort"},
                                                  {pcp: 4, stream: "video"}]

*.switch*.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0},
                                                  {stream: "video", pcp: 4}]

*.switch1.numEthInterfaces =1
*.switch2.numEthInterfaces =1
*.switch1.eth[0].typename = "ExtLowerEthernetInterface"  
*.switch1.eth[0].mtu = 1500B  
*.switch1.eth[0].device = "ens36" 
*.switch1.eth[0].address="00-0c-29-4e-75-07"
*.switch2.eth[0].typename = "ExtLowerEthernetInterface"  
*.switch2.eth[0].mtu = 1500B  
*.switch2.eth[0].device = "ens38" 
*.switch2.eth[0].address="00-0c-29-4e-75-11"


*.switch1.hasEgressTrafficShaping = true
*.switch2.hasEgressTrafficShaping = true
*.switch1.eth[1].macLayer.queue.numTrafficClasses = 2
*.switch1.eth[2].macLayer.queue.numTrafficClasses = 2
*.switch2.eth[1].macLayer.queue.numTrafficClasses = 2
*.switch2.eth[2].macLayer.queue.numTrafficClasses = 2
*.switch1.eth[1].macLayer.queue.*[0].display-name = "best effort"
*.switch1.eth[2].macLayer.queue.*[0].display-name = "best effort"
*.switch2.eth[1].macLayer.queue.*[0].display-name = "best effort"
*.switch2.eth[2].macLayer.queue.*[0].display-name = "best effort"
*.switch1.eth[1].macLayer.queue.*[1].display-name = "video"
*.switch1.eth[2].macLayer.queue.*[1].display-name = "video"
*.switch2.eth[1].macLayer.queue.*[1].display-name = "video"
*.switch2.eth[2].macLayer.queue.*[1].display-name = "video"
*.switch1.eth[1].macLayer.queue.transmissionGate[0].offset = 0ms
*.switch1.eth[2].macLayer.queue.transmissionGate[0].offset = 0ms
*.switch1.eth[1].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.switch1.eth[2].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.switch1.eth[1].macLayer.queue.transmissionGate[1].offset = 6ms
*.switch1.eth[2].macLayer.queue.transmissionGate[1].offset = 6ms
*.switch1.eth[1].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms]
*.switch1.eth[2].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms
*.switch2.eth[1].macLayer.queue.transmissionGate[0].offset = 10ms
*.switch2.eth[2].macLayer.queue.transmissionGate[0].offset = 10ms
*.switch2.eth[1].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.switch2.eth[2].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.switch2.eth[1].macLayer.queue.transmissionGate[1].offset = 16ms
*.switch2.eth[2].macLayer.queue.transmissionGate[1].offset = 16ms
*.switch2.eth[1].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms]
*.switch2.eth[2].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms]

I know it's probably some silly mistake, but do you have idea about how to use ExtLowerEthernetInterface in TsnSwitch?

Thanks!

@levy levy self-assigned this Jan 5, 2023
@levy levy added this to the INET 4.6 milestone Feb 21, 2023
@levy levy added the Bug label Feb 21, 2023
@levy
Copy link
Contributor

levy commented Mar 27, 2024

The provided example incorrectly connects the phys gate of the ExtLowerEthernetInterface module. That's not how this module is intended to be used. Also, this module is not useable with TSN traffic shaping features, because it lacks a queue submodule.

I understand your motivation to use all TSN features in an emulation setting but it's not fully supported at the moment.

@deepsea52418
Copy link
Author

Thank you for your reply. I'm wondering if I can use the ExtEthernetSocket module combined with the TSN Enabled EthernetInterface module to achieve this function

@levy
Copy link
Contributor

levy commented Mar 29, 2024

It may work, although I never tried such a configuration and didn't think about that usage. That's the whole point of having modules with some specific behavior after all, you can combine them in unforeseen ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants