Ns3 Projects for B.E/B.Tech M.E/M.Tech PhD Scholars.  Phone-Number:9790238391   E-mail: ns3simulation@gmail.com

How do I Run a Python File in Ns3

             In general, all the programmers who are in the beginning stage can run the python file in ns3 and this article is the guidance for that process.

Step: 1 Ns3 Main File Creation

           As the initiation, we have to create the python based main simulation file and that is stored in the scratch folder.

Ns3 Main File Creation

Step: 2 Ns3 Python Code

       Additionally, our research experts have highlighted some sample python code based on the configuration in UDP application.

ns.core.LogComponentEnable("UdpEchoClientApplication", ns.core.LOG_LEVEL_INFO)
ns.core.LogComponentEnable("UdpEchoServerApplication", ns.core.LOG_LEVEL_INFO) …...
echoServer = ns.applications.UdpEchoServerHelper(9)
serverApps = echoServer.Install(csmaNodes.Get(nCsma))
echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma), 9)
ns.core.UintegerValue(1)) echoClient.SetAttribute("Interval",
ns.core.TimeValue(ns.core.Seconds (1.0)))
echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024))
clientApps = echoClient.Install(wifiStaNodes.Get (nWifi - 1))
Then, the below mentioned python code is for the Ip configuration process.
address = ns.internet.Ipv4AddressHelper()
p2pInterfaces =
csmaInterfaces = address.Assign(csmaDevices)

Step: 3 Run Python File

         To the end, we have to run the python file over the implementation of the below mentioned commands and the acquired result is also highlighted.

cd /home/research/ns-allinone-3.26/ns-3.26

sudo ./waf –pyrun scratch/Clinet_Server.py

Run Python File in Ns3

           We hope that we have offered the essential data to run the python file in ns3, you guys can reach us at any time to get rid of your difficulties.