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)
def test_input_package_unzipping(self): """ Loads test PED file and tries to extract the linked *.son package. Checks if the basic package structure is available in the work_dir after extraction. :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) self.assertTrue(os.path.exists(os.path.join(p.son_pkg_input_dir, "META-INF"))) self.assertTrue(os.path.exists(os.path.join(p.son_pkg_input_dir, "META-INF/MANIFEST.MF"))) self.assertTrue(os.path.exists(os.path.join(p.son_pkg_input_dir, "function_descriptors"))) self.assertTrue(os.path.exists(os.path.join(p.son_pkg_input_dir, "service_descriptors")))
def test_input_package_unzipping(self): """ Loads test PED file and tries to extract the linked *.son package. Checks if the basic package structure is available in the work_dir after extraction. :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) self.assertTrue( os.path.exists(os.path.join(p.son_pkg_input_dir, "META-INF"))) self.assertTrue( os.path.exists( os.path.join(p.son_pkg_input_dir, "META-INF/MANIFEST.MF"))) self.assertTrue( os.path.exists( os.path.join(p.son_pkg_input_dir, "function_descriptors"))) self.assertTrue( os.path.exists( os.path.join(p.son_pkg_input_dir, "service_descriptors")))
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")))
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") ))