Python Forum
configure delay on only one link using python3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
configure delay on only one link using python3
#1
How can I configure the delay on ONLY ONE link (not on all) in python3 and mininet where I have link_parameters = {'delay': '%dms' % delay_ms}


     link_parameters = {'delay': '%dms' % delay_ms}
        logging.info('*** Add switches and links\n')
        logging.info("parameters: {}".format(link_parameters))
        #s0 = self.addSwitch('s0')
        #s1 = self.addSwitch('s1')
        ssource = None
        for i in range(1, switches+1):
            switch_current = self.addSwitch('s%d'%i)
            print("switch_current: {}".format(switch_current))
            if i == 1:
                print("\t add link h1 e switch_current=s%d" % (i))
                self.addLink(h1, switch_current, cls=TCLink, **link_parameters)
            else:
                print("\t add link switch_previous=s%d e switch_current=s%d"%(i-1, i))
                self.addLink(switch_previous, switch_current, cls=TCLink, **link_parameters)
    
            if i == switches:
                print("\t add link switch_current=s%d e h2" % (i))
                self.addLink(switch_current, h2, cls=TCLink, **link_parameters)
    
            switch_previous = switch_current
    
        #logging.info("parameters: {}".format(link_parameters))
         
    
        #self.addLink(s0, s1, cls=TCLink, **link_parameters)
        #self.addLink(s1, h2, cls=TCLink, **link_parameters)
Reply
#2
(Oct-21-2020, 01:54 AM)HiImAl Wrote: How can I configure the delay on ONLY ONE link (not on all) in python3 and mininet where I have link_parameters = {'delay': '%dms' % delay_ms} ? Basically I need to set the time (delay) of just one link round trip but I have no idea how to do this


     link_parameters = {'delay': '%dms' % delay_ms}
        logging.info('*** Add switches and links\n')
        logging.info("parameters: {}".format(link_parameters))
        #s0 = self.addSwitch('s0')
        #s1 = self.addSwitch('s1')
        ssource = None
        for i in range(1, switches+1):
            switch_current = self.addSwitch('s%d'%i)
            print("switch_current: {}".format(switch_current))
            if i == 1:
                print("\t add link h1 e switch_current=s%d" % (i))
                self.addLink(h1, switch_current, cls=TCLink, **link_parameters)
            else:
                print("\t add link switch_previous=s%d e switch_current=s%d"%(i-1, i))
                self.addLink(switch_previous, switch_current, cls=TCLink, **link_parameters)
    
            if i == switches:
                print("\t add link switch_current=s%d e h2" % (i))
                self.addLink(switch_current, h2, cls=TCLink, **link_parameters)
    
            switch_previous = switch_current
    
        #logging.info("parameters: {}".format(link_parameters))
         
    
        #self.addLink(s0, s1, cls=TCLink, **link_parameters)
        #self.addLink(s1, h2, cls=TCLink, **link_parameters)
Reply
#3
(Oct-21-2020, 01:09 PM)HiImAl Wrote:
(Oct-21-2020, 01:54 AM)HiImAl Wrote: How can I configure the delay on ONLY ONE link (not on all) in python3 and mininet where I have link_parameters = {'delay': '%dms' % delay_ms} ? Basically I need to set the time (delay) of just one link round trip but I have no idea how to do this


     link_parameters = {'delay': '%dms' % delay_ms}
        logging.info('*** Add switches and links\n')
        logging.info("parameters: {}".format(link_parameters))
        #s0 = self.addSwitch('s0')
        #s1 = self.addSwitch('s1')
        ssource = None
        for i in range(1, switches+1):
            switch_current = self.addSwitch('s%d'%i)
            print("switch_current: {}".format(switch_current))
            if i == 1:
                print("\t add link h1 e switch_current=s%d" % (i))
                self.addLink(h1, switch_current, cls=TCLink, **link_parameters)
            else:
                print("\t add link switch_previous=s%d e switch_current=s%d"%(i-1, i))
                self.addLink(switch_previous, switch_current, cls=TCLink, **link_parameters)
    
            if i == switches:
                print("\t add link switch_current=s%d e h2" % (i))
                self.addLink(switch_current, h2, cls=TCLink, **link_parameters)
    
            switch_previous = switch_current
    
        #logging.info("parameters: {}".format(link_parameters))
         
    
        #self.addLink(s0, s1, cls=TCLink, **link_parameters)
        #self.addLink(s1, h2, cls=TCLink, **link_parameters)
Reply
#4
cross-posted at SO: https://stackoverflow.com/q/64470738/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to add a delay right after a request.get() cubangt 6 2,662 Sep-07-2023, 09:29 AM
Last Post: shoesinquiry
  Request Delay pheadrus 1 3,781 Nov-25-2021, 08:51 PM
Last Post: snippsat
  adding a delay on end Daz2264 6 2,472 Sep-29-2021, 02:57 PM
Last Post: deanhystad
  python delay without interrupt the whole code Nick_tkinter 4 5,131 Feb-22-2021, 10:51 PM
Last Post: nilamo
  How to read CSV file one row at the time in a range and some delay in between greenpine 2 4,734 Nov-20-2020, 02:26 PM
Last Post: greenpine
  configure Github with python yellareddy 1 8,737 Apr-20-2020, 05:37 PM
Last Post: buran
  Keyboard commands and delay/latency RungJa 0 2,127 Mar-29-2020, 01:28 PM
Last Post: RungJa
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 4,890 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Configure a logging.config ytigiev 0 1,870 Feb-15-2019, 06:06 AM
Last Post: ytigiev
  Unwanted delay between looped synth plays WolfeCreek 1 2,313 Aug-02-2018, 09:24 PM
Last Post: Vysero

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020