#include "parameter.h"
#include <malloc.h>
+#define TARGET_IP_V4 "10.144.169.71"
+#define TARGET_IP_V6 "fe80::213:21ff:feb5:95fb%eth0"
+#define TARGET_HOSTNAME "um08"
+
int get_string_stubmode = 0;
int get_int_stubmode = 0;
+char target_ip[256] = TARGET_IP_V4;
-char *get_string_table[] = {
- "10.144.169.86", // "ip_addr"
+char get_string_table[][ 256 ] = {
+ TARGET_IP_V4, // "ip_addr"
"40000", // "service_name"
"eth0", // "nic"
"virtualservice", // "cmponent_id_00"
"chash", // "cmponent_id_01"
"sslid", // "cmponent_id_02"
};
+
int get_int_table[] = {
10000, // "interval"
64, // "cmponent_size_00"
boost::asio::io_service global_send_io;
void receiver_thread(){
- boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( "10.144.169.86" ), 40000 );
+ boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( target_ip ), 40000 );
boost::asio::ip::udp::socket receiver_socket( global_receive_io, udp_endpoint );
char *recv_memory;
}
void sender2_thread(){
- boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( "10.144.169.86" ), 40000 );
+ boost::asio::ip::udp::endpoint udp_endpoint( boost::asio::ip::address::from_string( target_ip ), 40000 );
// boost::asio::ip::udp::socket sender_socket( global_send_io, udp_endpoint );
boost::asio::ip::udp::socket sender_socket( global_send_io );
//test case1.
void replication_initialize_test(){
// int loop;
+ std::cout << "test111" << std::endl;
+
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
get_int_table[3] = 200; // "cmponent_size_02"
get_int_table[4] = 10; // "compulsorily_interval"
+ std::cout << "test222!" << std::endl;
+
// unit_test[1] コンストラクタのテスト
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
l7vs::replication repli1;
get_int_table[0] = 10000; // "interval"
// unit_test[28] check_parameterのテスト(component_idが重複)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
- get_string_table[4] = "virtualservice"; // "cmponent_id_01"
- get_string_table[5] = "virtualservice"; // "cmponent_id_02"
+ strcpy( get_string_table[4], "virtualservice" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "virtualservice" ); // "cmponent_id_02"
repli1.finalize();
BOOST_CHECK_EQUAL( repli1.initialize(), -1 );
BOOST_CHECK_EQUAL( repli1.get_status(), l7vs::replication::REPLICATION_SINGLE );
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
// unit_test[29] check_parameterのテスト(total_blockが上限以上)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
void replication_switch_to_master_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_switch_to_slave_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_dump_memory_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_start_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_stop_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_force_replicate_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_reset_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_get_status_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_lock_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_unlock_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_refer_lock_mutex_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_handle_send_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_set_master_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
// unit_test[143] set_masterのテスト(ip_adrが不正)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
- get_string_table[0] = "192:168:0:20"; // "ip_addr"
+ strcpy( get_string_table[0], "192:168:0:20" ); // "ip_addr"
repli1.finalize();
BOOST_CHECK_EQUAL( repli1.get_status(), l7vs::replication::REPLICATION_OUT );
BOOST_CHECK_EQUAL( repli1.set_master_wrapper(), 0 ); // set_masterの時点ではendpointを使用していない
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
repli1.finalize();
}
void replication_set_slave_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
// unit_test[145] set_slaveのテスト(ip_adrが不正)
BOOST_MESSAGE( boost::format( "unit_test[%d]" ) % ++count );
- get_string_table[0] = "192:168:0:20"; // "ip_addr"
+ strcpy( get_string_table[0], "192:168:0:20" ); // "ip_addr"
// get_string_table[0] = "10.144.169.87"; // "ip_addr" 作成失敗だと0.0.0.0:0でbind成功してしまうので使えないIPで
repli1.finalize();
// BOOST_CHECK_EQUAL( repli1.set_slave_wrapper(), -1 ); // 無理?
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
repli1.finalize();
}
void replication_check_parameter_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_getrpl_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_getcmp_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_getsrf_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_make_serial_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_releaserpl_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_releasecmp_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_releasesrf_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_finalize_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
void replication_handle_receive_test(){
get_string_stubmode = 0;
get_int_stubmode = 0;
- get_string_table[0] = "10.144.169.86"; // "ip_addr"
- get_string_table[1] = "40000"; // "service_name"
- get_string_table[2] = "eth0"; // "nic"
- get_string_table[3] = "virtualservice"; // "cmponent_id_00"
- get_string_table[4] = "chash"; // "cmponent_id_01"
- get_string_table[5] = "sslid"; // "cmponent_id_02"
+ strcpy( get_string_table[0], target_ip ); // "ip_addr"
+ strcpy( get_string_table[1], "40000" ); // "service_name"
+ strcpy( get_string_table[2], "eth0" ); // "nic"
+ strcpy( get_string_table[3], "virtualservice" ); // "cmponent_id_00"
+ strcpy( get_string_table[4], "chash" ); // "cmponent_id_01"
+ strcpy( get_string_table[5], "sslid" ); // "cmponent_id_02"
get_int_table[0] = 10000; // "interval"
get_int_table[1] = 64; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
l7vs::replication repli1;
- get_string_table[0] = "um05"; // "ip_addr"
+ //get_string_table[0] = TARGET_HOSTNAME; // "ip_addr"
+ strcpy( get_string_table[0], target_ip); // "ip_addr"
get_int_table[1] = 1; // "cmponent_size_00"
get_int_table[2] = 1; // "cmponent_size_01"
get_int_table[3] = 1; // "cmponent_size_02"
l7vs::Parameter parameter;
logger.loadConf();
+
+ //IPV4 test
+ strcpy( target_ip, TARGET_IP_V4);
+
// create unit test suite
test_suite* ts = BOOST_TEST_SUITE( "replication_test" );
framework::master_test_suite().add( ts );
+ //IPV6 TEST
+ strcpy( target_ip, TARGET_IP_V6);
+
+ // create unit test suite
+ test_suite* ts2 = BOOST_TEST_SUITE( "replication_test" );
+
+ // add test case to test suite
+ ts2->add( BOOST_TEST_CASE( &replication_initialize_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_switch_to_master_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_switch_to_slave_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_pay_memory_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_dump_memory_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_start_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_stop_test ) );
+
+ ts2->add( BOOST_TEST_CASE( &replication_force_replicate_test ) );
+
+ ts2->add( BOOST_TEST_CASE( &replication_reset_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_get_status_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_lock_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_unlock_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_refer_lock_mutex_test ) );
+
+ ts2->add( BOOST_TEST_CASE( &replication_handle_send_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_set_master_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_set_slave_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_check_parameter_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_getrpl_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_getcmp_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_getsrf_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_make_serial_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_releaserpl_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_releasecmp_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_releasesrf_test ) );
+ ts2->add( BOOST_TEST_CASE( &replication_finalize_test ) );
+
+ ts2->add( BOOST_TEST_CASE( &replication_handle_receive_test ) );
+
+ framework::master_test_suite().add( ts2 );
+
return 0;
}