def install_plugin_v4(self): # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_V4_PATH) self.env.admin_actions.upload_plugin( plugin=EXAMPLE_PLUGIN_V4_PATH) self.env.admin_actions.install_plugin( plugin_file_name=basename(EXAMPLE_PLUGIN_V4_PATH))
def deploy_ha_one_controller_neutron_example_v3(self): """Deploy cluster with one controller and example plugin v3 Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 node with compute role 6. Add 1 node with custom role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Run OSTF Duration 35m Snapshot deploy_ha_one_controller_neutron_example_v3 """ self.env.revert_snapshot("ready_with_3_slaves") with self.env.d_env.get_admin_remote() as admin_remote: # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_V3_PATH) checkers.upload_tarball( admin_remote, EXAMPLE_PLUGIN_V3_PATH, '/var') # install plugin checkers.install_plugin_check_code( admin_remote, plugin=os.path.basename(EXAMPLE_PLUGIN_V3_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT_TYPE } ) plugin_name = 'fuel_plugin_example_v3' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['fuel_plugin_example_v3'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.assert_os_services_ready(cluster_id) self.fuel_web.verify_network(cluster_id) # check if slave-01 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh] with self.env.fuel_web.get_ssh_for_node('slave-01') as remote: checkers.check_file_exists(remote, '/tmp/plugin+100.0.all') checkers.check_file_exists(remote, '/tmp/plugin+100.all') checkers.check_file_exists(remote, '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(remote, '/tmp/fuel_plugin_example_v3_puppet') # check if fuel_plugin_example_v3_puppet called # between netconfig and connectivity_tests netconfig_str = 'MODULAR: netconfig.pp' plugin_str = 'PLUGIN: fuel_plugin_example_v3 - deploy.pp' connect_str = 'MODULAR: connectivity_tests.pp' checkers.check_log_lines_order(remote, log_file_path='/var/log/puppet.log', line_matcher=[netconfig_str, plugin_str, connect_str]) # check if slave-02 contain # plugin+100.0.all # plugin+100.al with self.env.fuel_web.get_ssh_for_node('slave-02') as remote: checkers.check_file_exists(remote, '/tmp/plugin+100.0.all') checkers.check_file_exists(remote, '/tmp/plugin+100.all') # check if slave-03 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh # fuel_plugin_example_v3_puppet with self.env.fuel_web.get_ssh_for_node('slave-03') as remote: checkers.check_file_exists(remote, '/tmp/plugin+100.0.all') checkers.check_file_exists(remote, '/tmp/plugin+100.all') checkers.check_file_exists(remote, '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(remote, '/tmp/fuel_plugin_example_v3_puppet') # check if service run on slave-03 logger.debug("Checking service on node {0}".format('slave-03')) cmd = 'pgrep -f fuel-simple-service' res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Command {0} failed with error {1}' .format(cmd, res_pgrep['stderr'])) process_count = len(res_pgrep['stdout']) assert_equal(1, process_count, "There should be 1 process 'fuel-simple-service'," " but {0} found {1} processes".format(cmd, process_count)) # curl to service cmd_curl = 'curl localhost:8234' res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Command {0} failed with error {1}' .format(cmd_curl, res_curl['stderr'])) self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_ha_one_controller_neutron_example_v3")
def deploy_ha_one_controller_neutron_example(self): """Deploy cluster with one controller and example plugin Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 2 nodes with compute role 6. Deploy the cluster 7. Run network verification 8. Check plugin health 9. Run OSTF Duration 35m Snapshot deploy_ha_one_controller_neutron_example """ self.env.revert_snapshot("ready_with_3_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) with self.env.d_env.get_admin_remote() as remote: checkers.upload_tarball( remote, EXAMPLE_PLUGIN_PATH, '/var') # install plugin checkers.install_plugin_check_code( remote, plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) segment_type = NEUTRON_SEGMENT['vlan'] cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": segment_type, } ) plugin_name = 'fuel_plugin_example' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['compute'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.verify_network(cluster_id) # check if service ran on controller logger.debug("Start to check service on node {0}".format('slave-01')) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node("slave-01") as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_pgrep['stderr'])) assert_equal(1, len(res_pgrep['stdout']), 'Failed with error {0}'.format(res_pgrep['stderr'])) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_curl['stderr'])) self.fuel_web.run_ostf( cluster_id=cluster_id) self.env.make_snapshot("deploy_ha_one_controller_neutron_example")
def deploy_ha_one_controller_neutron_example_v3(self): """Deploy cluster with one controller and example plugin v3 Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 node with compute role 6. Add 1 node with custom role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Run OSTF Duration 35m Snapshot deploy_ha_one_controller_neutron_example_v3 """ self.check_run("deploy_ha_one_controller_neutron_example_v3") checkers.check_plugin_path_env( var_name='EXAMPLE_PLUGIN_V3_PATH', plugin_path=EXAMPLE_PLUGIN_V3_PATH ) self.env.revert_snapshot("ready_with_3_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_V3_PATH) utils.upload_tarball( ip=self.ssh_manager.admin_ip, tar_path=EXAMPLE_PLUGIN_V3_PATH, tar_target='/var' ) # install plugin utils.install_plugin_check_code( ip=self.ssh_manager.admin_ip, plugin=os.path.basename(EXAMPLE_PLUGIN_V3_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={"propagate_task_deploy": True} ) plugin_name = 'fuel_plugin_example_v3' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['fuel_plugin_example_v3'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.assert_os_services_ready(cluster_id) self.fuel_web.verify_network(cluster_id) # check if slave-01 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh] slave1 = self.fuel_web.get_nailgun_node_by_name('slave-01') checkers.check_file_exists(slave1['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave1['ip'], '/tmp/plugin+100.all') checkers.check_file_exists(slave1['ip'], '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(slave1['ip'], '/tmp/fuel_plugin_example_v3_puppet') # check if fuel_plugin_example_v3_puppet called # between netconfig and connectivity_tests netconfig_str = 'MODULAR: netconfig/netconfig.pp' plugin_str = 'PLUGIN: fuel_plugin_example_v3 - deploy.pp' connect_str = 'MODULAR: netconfig/connectivity_tests.pp' checkers.check_log_lines_order( ip=slave1['ip'], log_file_path='/var/log/puppet.log', line_matcher=[netconfig_str, plugin_str, connect_str]) # check if slave-02 contain # plugin+100.0.all # plugin+100.al slave2 = self.fuel_web.get_nailgun_node_by_name('slave-02') checkers.check_file_exists(slave2['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave2['ip'], '/tmp/plugin+100.all') # check if slave-03 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh # fuel_plugin_example_v3_puppet slave3 = self.fuel_web.get_nailgun_node_by_name('slave-03') checkers.check_file_exists(slave3['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave3['ip'], '/tmp/plugin+100.all') checkers.check_file_exists(slave3['ip'], '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(slave3['ip'], '/tmp/fuel_plugin_example_v3_puppet') # check if service run on slave-03 logger.debug("Checking service on node {0}".format('slave-03')) cmd = 'pgrep -f fuel-simple-service' res_pgrep = self.ssh_manager.execute_on_remote( ip=slave3['ip'], cmd=cmd ) process_count = len(res_pgrep['stdout']) assert_equal(1, process_count, "There should be 1 process 'fuel-simple-service'," " but {0} found {1} processes".format(cmd, process_count)) # curl to service cmd_curl = 'curl localhost:8234' self.ssh_manager.execute_on_remote( ip=slave3['ip'], cmd=cmd_curl ) self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_ha_one_controller_neutron_example_v3", is_make=True)
def deploy_neutron_example_ha_add_node(self): """Deploy and scale cluster in ha mode with example plugin Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 nodes with compute role 6. Add 1 nodes with cinder role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Add 2 nodes with controller role 11. Deploy cluster 12. Check plugin health 13. Run OSTF Duration 150m Snapshot deploy_neutron_example_ha_add_node """ checkers.check_plugin_path_env( var_name='EXAMPLE_PLUGIN_PATH', plugin_path=EXAMPLE_PLUGIN_PATH ) self.env.revert_snapshot("ready_with_5_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) utils.upload_tarball( ip=self.ssh_manager.admin_ip, tar_path=EXAMPLE_PLUGIN_PATH, tar_target='/var') # install plugin utils.install_plugin_check_code( ip=self.ssh_manager.admin_ip, plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT['tun'], "propagate_task_deploy": True } ) plugin_name = 'fuel_plugin_example' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['cinder'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.verify_network(cluster_id) # check if service ran on controller logger.debug("Start to check service on node {0}".format('slave-01')) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node('slave-01') as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_pgrep['stderr'])) assert_equal(1, len(res_pgrep['stdout']), 'Failed with error {0}'.format(res_pgrep['stderr'])) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_curl['stderr'])) self.fuel_web.update_nodes( cluster_id, { 'slave-04': ['controller'], 'slave-05': ['controller'], } ) self.fuel_web.deploy_cluster_wait(cluster_id) for node in ('slave-01', 'slave-04', 'slave-05'): logger.debug("Start to check service on node {0}".format(node)) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node(node) as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_pgrep['stderr'], node)) assert_equal(1, len(res_pgrep['stdout']), 'Failed with error {0} on the ' 'node {1}'.format(res_pgrep['stderr'], node)) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_curl['stderr'], node)) # add verification here self.fuel_web.run_ostf( cluster_id=cluster_id) self.env.make_snapshot("deploy_neutron_example_ha_add_node")
def deploy_neutron_example_ha_add_node(self): """Deploy and scale cluster in ha mode with example plugin Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 nodes with compute role 6. Add 1 nodes with cinder role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Add 2 nodes with controller role 11. Deploy cluster 12. Check plugin health 13. Run OSTF Duration 150m Snapshot deploy_neutron_example_ha_add_node """ checkers.check_plugin_path_env(var_name='EXAMPLE_PLUGIN_PATH', plugin_path=EXAMPLE_PLUGIN_PATH) self.env.revert_snapshot("ready_with_5_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) utils.upload_tarball(ip=self.ssh_manager.admin_ip, tar_path=EXAMPLE_PLUGIN_PATH, tar_target='/var') # install plugin utils.install_plugin_check_code( ip=self.ssh_manager.admin_ip, plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster(name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={ "net_provider": 'neutron', "net_segment_type": NEUTRON_SEGMENT['tun'], "propagate_task_deploy": True }) plugin_name = 'fuel_plugin_example' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true(self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['cinder'] }) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.verify_network(cluster_id) # check if service ran on controller logger.debug("Start to check service on node {0}".format('slave-01')) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node('slave-01') as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_pgrep['stderr'])) assert_equal(1, len(res_pgrep['stdout']), 'Failed with error {0}'.format(res_pgrep['stderr'])) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0}'.format(res_curl['stderr'])) self.fuel_web.update_nodes(cluster_id, { 'slave-04': ['controller'], 'slave-05': ['controller'], }) self.fuel_web.deploy_cluster_wait(cluster_id) for node in ('slave-01', 'slave-04', 'slave-05'): logger.debug("Start to check service on node {0}".format(node)) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node(node) as remote: res_pgrep = remote.execute(cmd) assert_equal( 0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_pgrep['stderr'], node)) assert_equal( 1, len(res_pgrep['stdout']), 'Failed with error {0} on the ' 'node {1}'.format(res_pgrep['stderr'], node)) # curl to service res_curl = remote.execute(cmd_curl) assert_equal( 0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_curl['stderr'], node)) # add verification here self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_neutron_example_ha_add_node")
def deploy_ha_one_controller_neutron_example_v3(self): """Deploy cluster with one controller and example plugin v3 Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 node with compute role 6. Add 1 node with custom role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Run OSTF Duration 35m Snapshot deploy_ha_one_controller_neutron_example_v3 """ self.check_run("deploy_ha_one_controller_neutron_example_v3") checkers.check_plugin_path_env(var_name='EXAMPLE_PLUGIN_V3_PATH', plugin_path=EXAMPLE_PLUGIN_V3_PATH) self.env.revert_snapshot("ready_with_3_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_V3_PATH) utils.upload_tarball(ip=self.ssh_manager.admin_ip, tar_path=EXAMPLE_PLUGIN_V3_PATH, tar_target='/var') # install plugin utils.install_plugin_check_code( ip=self.ssh_manager.admin_ip, plugin=os.path.basename(EXAMPLE_PLUGIN_V3_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={"propagate_task_deploy": True}) plugin_name = 'fuel_plugin_example_v3' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true(self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['compute'], 'slave-03': ['fuel_plugin_example_v3'] }) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.assert_os_services_ready(cluster_id) self.fuel_web.verify_network(cluster_id) # check if slave-01 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh] slave1 = self.fuel_web.get_nailgun_node_by_name('slave-01') checkers.check_file_exists(slave1['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave1['ip'], '/tmp/plugin+100.all') checkers.check_file_exists(slave1['ip'], '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(slave1['ip'], '/tmp/fuel_plugin_example_v3_puppet') # check if fuel_plugin_example_v3_puppet called # between netconfig and connectivity_tests netconfig_str = 'MODULAR: netconfig/netconfig.pp' plugin_str = 'PLUGIN: fuel_plugin_example_v3 - deploy.pp' connect_str = 'MODULAR: netconfig/connectivity_tests.pp' checkers.check_log_lines_order( ip=slave1['ip'], log_file_path='/var/log/puppet.log', line_matcher=[netconfig_str, plugin_str, connect_str]) # check if slave-02 contain # plugin+100.0.all # plugin+100.al slave2 = self.fuel_web.get_nailgun_node_by_name('slave-02') checkers.check_file_exists(slave2['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave2['ip'], '/tmp/plugin+100.all') # check if slave-03 contain # plugin+100.0.all # plugin+100.all # fuel_plugin_example_v3_sh # fuel_plugin_example_v3_puppet slave3 = self.fuel_web.get_nailgun_node_by_name('slave-03') checkers.check_file_exists(slave3['ip'], '/tmp/plugin+100.0.all') checkers.check_file_exists(slave3['ip'], '/tmp/plugin+100.all') checkers.check_file_exists(slave3['ip'], '/tmp/fuel_plugin_example_v3_sh') checkers.check_file_exists(slave3['ip'], '/tmp/fuel_plugin_example_v3_puppet') # check if service run on slave-03 logger.debug("Checking service on node {0}".format('slave-03')) cmd = 'pgrep -f fuel-simple-service' res_pgrep = self.ssh_manager.execute_on_remote(ip=slave3['ip'], cmd=cmd) process_count = len(res_pgrep['stdout']) assert_equal( 1, process_count, "There should be 1 process 'fuel-simple-service'," " but {0} found {1} processes".format(cmd, process_count)) # curl to service cmd_curl = 'curl localhost:8234' self.ssh_manager.execute_on_remote(ip=slave3['ip'], cmd=cmd_curl) self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_ha_one_controller_neutron_example_v3", is_make=True)
def deploy_neutron_example_ha_add_node(self): """Deploy and scale cluster in ha mode with example plugin Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 1 node with controller role 5. Add 1 nodes with compute role 6. Add 1 nodes with cinder role 7. Deploy the cluster 8. Run network verification 9. Check plugin health 10. Add 2 nodes with controller role 11. Deploy cluster 12. Check plugin health 13. Run OSTF Duration 150m Snapshot deploy_neutron_example_ha_add_node """ self.env.revert_snapshot("ready_with_5_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) checkers.upload_tarball(self.env.d_env.get_admin_remote(), EXAMPLE_PLUGIN_PATH, "/var") # install plugin checkers.install_plugin_check_code( self.env.d_env.get_admin_remote(), plugin=os.path.basename(EXAMPLE_PLUGIN_PATH) ) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, settings={"net_provider": "neutron", "net_segment_type": NEUTRON_SEGMENT["tun"]}, ) plugin_name = "fuel_plugin_example" msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true(self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {"metadata/enabled": True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, {"slave-01": ["controller"], "slave-02": ["compute"], "slave-03": ["cinder"]} ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.verify_network(cluster_id) # check if service ran on controller logger.debug("Start to check service on node {0}".format("slave-01")) cmd_curl = "curl localhost:8234" cmd = "pgrep -f fuel-simple-service" with self.fuel_web.get_ssh_for_node("slave-01") as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep["exit_code"], "Failed with error {0}".format(res_pgrep["stderr"])) assert_equal(1, len(res_pgrep["stdout"]), "Failed with error {0}".format(res_pgrep["stderr"])) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep["exit_code"], "Failed with error {0}".format(res_curl["stderr"])) self.fuel_web.update_nodes(cluster_id, {"slave-04": ["controller"], "slave-05": ["controller"]}) self.fuel_web.deploy_cluster_wait(cluster_id) for node in ("slave-01", "slave-04", "slave-05"): logger.debug("Start to check service on node {0}".format(node)) cmd_curl = "curl localhost:8234" cmd = "pgrep -f fuel-simple-service" with self.fuel_web.get_ssh_for_node(node) as remote: res_pgrep = remote.execute(cmd) assert_equal( 0, res_pgrep["exit_code"], "Failed with error {0} " "on node {1}".format(res_pgrep["stderr"], node) ) assert_equal( 1, len(res_pgrep["stdout"]), "Failed with error {0} on the " "node {1}".format(res_pgrep["stderr"], node), ) # curl to service res_curl = remote.execute(cmd_curl) assert_equal( 0, res_pgrep["exit_code"], "Failed with error {0} " "on node {1}".format(res_curl["stderr"], node) ) # add verification here self.fuel_web.run_ostf(cluster_id=cluster_id) self.env.make_snapshot("deploy_neutron_example_ha_add_node")
def install_plugin_v4(self): # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_V4_PATH) self.env.admin_actions.upload_plugin(plugin=EXAMPLE_PLUGIN_V4_PATH) self.env.admin_actions.install_plugin( plugin_file_name=basename(EXAMPLE_PLUGIN_V4_PATH))
def deploy_neutron_example_ha(self): """Deploy cluster in ha mode with example plugin Scenario: 1. Upload plugin to the master node 2. Install plugin 3. Create cluster 4. Add 3 node with controller role 5. Add 1 nodes with compute role 6. Add 1 nodes with cinder role 7. Deploy the cluster 8. Run network verification 9. check plugin health 10. Run OSTF Duration 70m Snapshot deploy_neutron_example_ha """ self.env.revert_snapshot("ready_with_5_slaves") # copy plugin to the master node checkers.check_archive_type(EXAMPLE_PLUGIN_PATH) with self.env.d_env.get_admin_remote() as remote: checkers.upload_tarball( remote, EXAMPLE_PLUGIN_PATH, '/var') # install plugin checkers.install_plugin_check_code( remote, plugin=os.path.basename(EXAMPLE_PLUGIN_PATH)) cluster_id = self.fuel_web.create_cluster( name=self.__class__.__name__, mode=DEPLOYMENT_MODE, ) plugin_name = 'fuel_plugin_example' msg = "Plugin couldn't be enabled. Check plugin version. Test aborted" assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) options = {'metadata/enabled': True} self.fuel_web.update_plugin_data(cluster_id, plugin_name, options) self.fuel_web.update_nodes( cluster_id, { 'slave-01': ['controller'], 'slave-02': ['controller'], 'slave-03': ['controller'], 'slave-04': ['compute'], 'slave-05': ['cinder'] } ) self.fuel_web.deploy_cluster_wait(cluster_id) self.fuel_web.verify_network(cluster_id) for node in ('slave-01', 'slave-02', 'slave-03'): logger.debug("Start to check service on node {0}".format(node)) cmd_curl = 'curl localhost:8234' cmd = 'pgrep -f fuel-simple-service' with self.fuel_web.get_ssh_for_node(node) as remote: res_pgrep = remote.execute(cmd) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_pgrep['stderr'], node)) assert_equal(1, len(res_pgrep['stdout']), 'Failed with error {0} on the ' 'node {1}'.format(res_pgrep['stderr'], node)) # curl to service res_curl = remote.execute(cmd_curl) assert_equal(0, res_pgrep['exit_code'], 'Failed with error {0} ' 'on node {1}'.format(res_curl['stderr'], node)) self.fuel_web.run_ostf( cluster_id=cluster_id) self.env.make_snapshot("deploy_neutron_example_ha")