Esempio n. 1
0
 def netns_killall():
     """
     Kill all netns.
     """
     command = 'sudo ip -all netns del'
     proc=Process(cmd=command)
     proc.get_process_result()
Esempio n. 2
0
 def get_ipv6_addr_list(netns, interface_name):
     """
     Get the ipv6 address from the specified net ns and network interface name
     """
     command = "sudo ip netns exec %s " % netns
     command += "ifconfig %s | grep inet6 | awk -F ' ' '{print $2}'" % interface_name
     proc = Process(cmd=command)
     return proc.get_process_result().split()
Esempio n. 3
0
 def cleanup_netns():
     """
     Kill all PIDs running in the netns.
     Delete the netns.
     """
     # self.log_info("Cleaning up network namespace for %s" % self.device_path)
     command = 'sudo ip -all netns del'
     proc=Process(cmd=command)
     proc.get_process_result()
Esempio n. 4
0
    def delete_netns(serial_number):
        """
        Delete netns containing this Needle.
        """
        # self.log_info("Deleting network namespace for %s" % self.device_path)

        command = "sudo ip netns del %s" % serial_number
        proc = Process(cmd=command)
        print(command)
        proc.get_process_result()
Esempio n. 5
0
    def link_set(self, interface_name):
        """
        Assign a network namespace link endpoint to this network namespace.
        Bring up the new interface.
        """
        command = "ip link set %s netns %s" % (interface_name, self.netns)
        self.make_system_call_async("link-set", command, "", 1, None)

        command = "ifconfig %s up" % interface_name
        Process.execute_command(cmd=command)
Esempio n. 6
0
 def create_netns(serial_number):
     """
     wpantund will run in a network namespace for these tests.
     This function should be called on instantiation to create a
     unique network namespace name.
     This function returns the network namepsace name.
     """
     print("Adding network namespace for %s" % serial_number)
     command = "sudo ip netns add %s" % serial_number
     proc = Process(cmd=command)
     proc.process_cmd_asyc()
Esempio n. 7
0
    def image_flash(self, serial_number, fw_file, result_log_path=None):
        flash_rel = True

        cmd = DirectoryPath.get_dir(
            'shell') + 'nrfjprog.sh ' + '--erase-all ' + serial_number
        self.logger.debug(cmd)

        proc = Process(cmd=cmd)
        log = proc.get_process_result()
        ret = log

        if not self.__verify_image_flash(log):
            flash_rel = False

        time.sleep(2)

        cmd = DirectoryPath.get_dir(
            'shell'
        ) + 'nrfjprog.sh ' + '--flash ' + fw_file + ' ' + serial_number
        self.logger.debug(cmd)

        proc = Process(cmd=cmd)
        log = proc.get_process_result()
        ret += log

        if not self.__verify_image_flash(log):
            flash_rel = False

        self.logger.debug(ret)
        if result_log_path:
            self.__write_to_log(result_log_path, 'nrf52840_flash.log', ret)

        time.sleep(5)

        self.flash_result = flash_rel

        return flash_rel
Esempio n. 8
0
from src.utils.process import Process
import random

processes = []

n = 7
burst = 10
priority = 5

# first process must arrive at time 0
processes.append(
    Process(0, 0, random.randint(1, burst), random.randint(1, priority)))

for i in range(1, n):
    p = Process(i, random.randint(1, n), random.randint(1, burst),
                random.randint(1, priority))
    processes.append(p)