def create_chain(tacker_client, default_param_file, neutron_port, COMMON_CONFIG, TESTCASE_CONFIG): tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir, COMMON_CONFIG.vnffgd_dir, TESTCASE_CONFIG.test_vnffgd_red) os_sfc_utils.create_vnffgd(tacker_client, tosca_file=tosca_file, vnffgd_name='red') os_sfc_utils.create_vnffg_with_param_file(tacker_client, 'red', 'red_http', default_param_file, neutron_port.id)
def create_vnffg(self, testcase_config_name, vnf_name, conn_name): """Create the vnffg components following the instructions from relevant templates. :param testcase_config_name: The config input of the test case :param vnf_name: The name of the vnf :param conn_name: Protocol type / name of the component :return: Create the vnffg component """ tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir, COMMON_CONFIG.vnffgd_dir, testcase_config_name) os_sfc_utils.create_vnffgd(self.tacker_client, tosca_file=tosca_file, vnffgd_name=vnf_name) self.neutron_port = openstack_sfc.get_client_port(self.client_instance, self.client_creator) os_sfc_utils.create_vnffg_with_param_file(self.tacker_client, vnf_name, conn_name, self.default_param_file, self.neutron_port.id)
def run(self): logger.info("The test scenario %s is starting", __name__) self.create_custom_vnfd(self.testcase_config.test_vnfd, 'test-vnfd1') self.create_custom_av(self.vnfs[0], 'test-vnfd1', 'test-vim') if self.vnf_id is None: logger.error('ERROR while booting VNF') sys.exit(1) tosca_file = os.path.join(COMMON_CONFIG.sfc_test_dir, COMMON_CONFIG.vnffgd_dir, self.testcase_config.test_vnffgd) os_sfc_utils.create_vnffgd(self.tacker_client, tosca_file=tosca_file, vnffgd_name='test-vnffgd') client_port = openstack_sfc.get_client_port(self.client_instance, self.client_creator) server_port = openstack_sfc.get_client_port(self.server_instance, self.server_creator) server_ip_prefix = self.server_ip + '/32' default_param_file = os.path.join( COMMON_CONFIG.sfc_test_dir, COMMON_CONFIG.vnfd_dir, COMMON_CONFIG.vnfd_default_params_file) os_sfc_utils.create_vnffg_with_param_file(self.tacker_client, 'test-vnffgd', 'test-vnffg', default_param_file, client_port.id, server_port.id, server_ip_prefix) # Start measuring the time it takes to implement the classification # rules t1 = threading.Thread(target=wait_for_classification_rules, args=( self.ovs_logger, self.compute_nodes, self.server_instance.compute_host, server_port, self.client_instance.compute_host, client_port, self.odl_ip, self.odl_port, )) try: t1.start() except Exception as e: logger.error("Unable to start the thread that counts time %s" % e) logger.info("Assigning floating IPs to instances") self.assign_floating_ip_client_server() vnf_ip = os_sfc_utils.get_vnf_ip(self.tacker_client, vnf_id=self.vnf_id) self.assign_floating_ip_sfs(vnf_ip) self.check_floating_ips() self.start_services_in_vm() self.vxlan_start_interface(self.fips_sfs[0], 'eth0', 'eth1', None) self.vxlan_start_interface(self.fips_sfs[0], 'eth1', 'eth0', None) logger.info("Wait for ODL to update the classification rules in OVS") t1.join() results = self.present_results_allowed_port_http(self.testcase_config) self.vxlan_blocking_stop(self.fips_sfs[0]) self.vxlan_start_interface(self.fips_sfs[0], 'eth0', 'eth1', "80") self.vxlan_start_interface(self.fips_sfs[0], 'eth1', 'eth0', None) results = self.present_results_blocked_port_http( self.testcase_config, 'HTTP uplink') self.vxlan_blocking_stop(self.fips_sfs[0]) self.vxlan_start_interface(self.fips_sfs[0], 'eth0', 'eth1', None) self.vxlan_start_interface(self.fips_sfs[0], 'eth1', 'eth0', self.testcase_config.source_port) results = self.present_results_blocked_port_http( self.testcase_config, 'HTTP downlink') self.vxlan_blocking_stop(self.fips_sfs[0]) self.vxlan_start_interface(self.fips_sfs[0], 'eth0', 'eth1', None) self.vxlan_start_interface(self.fips_sfs[0], 'eth1', 'eth0', None) results = self.present_results_allowed_http() if __name__ == '__main__': return results.compile_summary(), self.creators if __name__ == 'sfc.tests.functest.sfc_symmetric_chain': return results.compile_summary(), self.creators