Ejemplo n.º 1
0
 def test_input_package_content_loading(self):
     """
     Loads contents of test package and checks if the SonataServicePackage object is
     correctly created.
     :return:
     """
     args = parse_args(["-c", TEST_PED_FILE, "-v"])
     p = ProfileManager(args)
     extract_son_package(p._load_ped_file(p.args.config), p.son_pkg_input_dir)
     pkg = SonataServicePackage.load(p.son_pkg_input_dir)
     self.assertEqual(pkg.manifest.get("name"), "sonata-fw-vtc-service")
     self.assertEqual(pkg.nsd.get("name"), "sonata-fw-vtc-service")
     self.assertEqual(len(pkg.vnfd_list), 2)
Ejemplo n.º 2
0
 def test_input_package_content_loading(self):
     """
     Loads contents of test package and checks if the SonataServicePackage object is
     correctly created.
     :return:
     """
     args = parse_args(["-c", TEST_PED_FILE, "-v"])
     p = ProfileManager(args)
     extract_son_package(p._load_ped_file(p.args.config),
                         p.son_pkg_input_dir)
     pkg = SonataServicePackage.load(p.son_pkg_input_dir)
     self.assertEqual(pkg.manifest.get("name"), "sonata-fw-vtc-service")
     self.assertEqual(pkg.nsd.get("name"), "sonata-fw-vtc-service")
     self.assertEqual(len(pkg.vnfd_list), 2)
Ejemplo n.º 3
0
    def run(self):
        """
        Run son-profile
        :return:
        """
        # try to load PED file
        self.ped = self._load_ped_file(self.args.config)
        self._validate_ped_file(self.ped)
        # load and populate experiment specifications
        self.service_experiments, self.function_experiments = self._generate_experiment_specifications(
            self.ped)

        # execute profiling run on pre-deployed service
        # only service experiments are executed
        if not self.args.no_execution:
            for experiment in self.service_experiments:
                input_msd_path = experiment.input_metrics
                output_msd_path = experiment.output_metrics
                input_commands = experiment.command_space_list
                configuration_commands = experiment.configuration_space_dict
                resource_list = experiment.resource_space_list
                timeout = experiment.time_limit
                profiler = Emu_Profiler(
                    input_msd_path=input_msd_path,
                    output_msd_path=output_msd_path,
                    input_commands=input_commands,
                    configuration_commands=configuration_commands,
                    overload_vnf_list=experiment.overload_vnf_list,
                    timeout=timeout,
                    title=self.ped['name'],
                    no_display=self.args.no_display,
                    resource_configuration=resource_list,
                    vnforder_list=experiment.vnforder_list)
                profiler.start_experiment()

        # generate service packages
        if not self.args.no_generation:
            # unzip *.son package to be profiled and load its contents
            extract_son_package(self.ped, self.son_pkg_input_dir)
            self.son_pkg_input = SonataServicePackage.load(
                self.son_pkg_input_dir)
            # generate experiment services (modified NSDs, VNFDs for each experiment run)
            self.generated_services = self.generate_experiment_services()
            # package experiment services
            self.package_experiment_services()
            # print generation statistics
            self.print_generation_and_packaging_statistics()
Ejemplo n.º 4
0
 def run(self):
     """
     Run son-profile
     :return:
     """
     # try to load PED file
     self.ped = self._load_ped_file(self.args.config)
     self._validate_ped_file(self.ped)
     # unzip *.son package to be profiled and load its contents
     extract_son_package(self.ped, self.son_pkg_input_dir)
     self.son_pkg_input = SonataServicePackage.load(self.son_pkg_input_dir)
     # load and populate experiment specifications
     self.service_experiments, self.function_experiments = self._generate_experiment_specifications(self.ped)
     # generate experiment services (modified NSDs, VNFDs for each experiment run)
     self.generated_services = self.generate_experiment_services()
     # package experiment services
     self.package_experiment_services()
     # print generation statistics
     self.print_generation_and_packaging_statistics()
Ejemplo n.º 5
0
    def run(self):
        """
        Run son-profile
        :return:
        """
        # try to load PED file
        self.ped = self._load_ped_file(self.args.config)
        self._validate_ped_file(self.ped)
        # load and populate experiment specifications
        self.service_experiments, self.function_experiments = self._generate_experiment_specifications(self.ped)

        # execute profiling run on pre-deployed service
        # only service experiments are executed
        if not self.args.no_execution :
            for experiment in self.service_experiments:
                input_msd_path = experiment.input_metrics
                output_msd_path = experiment.output_metrics
                input_commands = experiment.command_space_list
                configuration_commands = experiment.configuration_space_dict
                resource_list = experiment.resource_space_list
                timeout = experiment.time_limit
                profiler = Emu_Profiler(input_msd_path=input_msd_path,
                                        output_msd_path=output_msd_path,
                                        input_commands=input_commands,
                                        configuration_commands=configuration_commands,
                                        overload_vnf_list = experiment.overload_vnf_list,
                                        timeout=timeout,
                                        title=self.ped['name'],
                                        no_display=self.args.no_display)
                profiler.start_experiment()

        # generate service packages
        if not self.args.no_generation :
            # unzip *.son package to be profiled and load its contents
            extract_son_package(self.ped, self.son_pkg_input_dir)
            self.son_pkg_input = SonataServicePackage.load(self.son_pkg_input_dir)
            # generate experiment services (modified NSDs, VNFDs for each experiment run)
            self.generated_services = self.generate_experiment_services()
            # package experiment services
            self.package_experiment_services()
            # print generation statistics
            self.print_generation_and_packaging_statistics()
Ejemplo n.º 6
0
 def test_output_service_generation(self):
     """
     Checks if service project files are created.
     :return:
     """
     args = parse_args(["-c", TEST_PED_FILE, "-v"])
     p = ProfileManager(args)
     extract_son_package(p._load_ped_file(p.args.config), p.son_pkg_input_dir)
     p.son_pkg_input = SonataServicePackage.load(p.son_pkg_input_dir)
     p.service_experiments, p.function_experiments = p._generate_experiment_specifications(
         p._load_ped_file(p.args.config))
     p.generate_experiment_services()
     self.assertTrue(os.path.exists(
         os.path.join(p.son_pkg_service_dir, "func_fw_throughput_00000")))
     self.assertTrue(os.path.exists(
         os.path.join(p.son_pkg_service_dir, "func_fw_throughput_00000/project.yml")))
     self.assertTrue(os.path.exists(
         os.path.join(p.son_pkg_service_dir, "func_fw_throughput_00000/sources/nsd/sonata-fw-vtc-service.yml")))
     self.assertTrue(os.path.exists(
         os.path.join(p.son_pkg_service_dir, "func_fw_throughput_00000/sources/vnf/fw-vnf/fw-vnf.yml")))
     self.assertTrue(os.path.exists(
         os.path.join(p.son_pkg_service_dir, "func_fw_throughput_00000/sources/vnf/vtc-vnf/vtc-vnf.yml")))
Ejemplo n.º 7
0
 def test_output_service_generation(self):
     """
     Checks if service project files are created.
     :return:
     """
     args = parse_args(["-c", TEST_PED_FILE, "-v"])
     p = ProfileManager(args)
     extract_son_package(p._load_ped_file(p.args.config),
                         p.son_pkg_input_dir)
     p.son_pkg_input = SonataServicePackage.load(p.son_pkg_input_dir)
     p.service_experiments, p.function_experiments = p._generate_experiment_specifications(
         p._load_ped_file(p.args.config))
     p.generate_experiment_services()
     self.assertTrue(
         os.path.exists(
             os.path.join(p.son_pkg_service_dir,
                          "func_fw_throughput_00000")))
     self.assertTrue(
         os.path.exists(
             os.path.join(p.son_pkg_service_dir,
                          "func_fw_throughput_00000/project.yml")))
     self.assertTrue(
         os.path.exists(
             os.path.join(
                 p.son_pkg_service_dir,
                 "func_fw_throughput_00000/sources/nsd/sonata-fw-vtc-service.yml"
             )))
     self.assertTrue(
         os.path.exists(
             os.path.join(
                 p.son_pkg_service_dir,
                 "func_fw_throughput_00000/sources/vnf/fw-vnf/fw-vnf.yml")))
     self.assertTrue(
         os.path.exists(
             os.path.join(
                 p.son_pkg_service_dir,
                 "func_fw_throughput_00000/sources/vnf/vtc-vnf/vtc-vnf.yml")
         ))