Added Auto Request/Response menu to invoke response after 2 secs of invoking a request action

parent 1817ddd3
......@@ -195,6 +195,39 @@ GET_USER_OPT:
my $traceroute_res_response = TracerouteResponse::traceroute_response($HOSTIP, $HOSTPORT, $TESTID_INFO, $CONTROL_URL);
ResponseValidator::valiate_soap_response($traceroute_res_response);
}
case 12 {
print "(AUTO)Enter the HostName to perform NSLookup : ";
my $HOST_NAME = <>;
chomp $HOST_NAME;
my $nslookup_req_response = NSLookUpRequest::nslookup_request($HOSTIP, $HOSTPORT, $HOST_NAME, $CONTROL_URL);
my $nslookup_response = ResponseValidator::valiate_soap_response($nslookup_req_response);
my $test_id_response = ResponseValidator::get_test_id_from_response($nslookup_response);
sleep(2);
my $nslookup_res_response = NSLookUpResponse::nslookup_response($HOSTIP, $HOSTPORT, $test_id_response, $CONTROL_URL);
ResponseValidator::valiate_soap_response($nslookup_res_response);
}
case 13 {
print "(AUTO)Enter the HostName to perform Ping : ";
my $HOST_NAME = <>;
chomp $HOST_NAME;
my $ping_req_response = PingRequest::ping_request($HOSTIP, $HOSTPORT, $HOST_NAME, $CONTROL_URL);
my $ping_response = ResponseValidator::valiate_soap_response($ping_req_response);
my $test_id_response = ResponseValidator::get_test_id_from_response($ping_response);
sleep(2);
my $ping_res_response = PingResponse::ping_response($HOSTIP, $HOSTPORT, $test_id_response, $CONTROL_URL);
ResponseValidator::valiate_soap_response($ping_res_response);
}
case 14 {
print "(AUTO)Enter the HostName to perform traceroute : ";
my $HOST_NAME = <>;
chomp $HOST_NAME;
my $traceroute_req_request = TracerouteRequest::traceroute_request($HOSTIP, $HOSTPORT, $HOST_NAME, $CONTROL_URL);
my $traceroute_response = ResponseValidator::valiate_soap_response($traceroute_req_request);
my $test_id_response = ResponseValidator::get_test_id_from_response($traceroute_response);
sleep(2);
my $traceroute_res_response = TracerouteResponse::traceroute_response($HOSTIP, $HOSTPORT, $test_id_response, $CONTROL_URL);
ResponseValidator::valiate_soap_response($traceroute_res_response);
}
case ('x') { goto START; }
else { goto GET_USER_OPT; }
}
......
......@@ -40,6 +40,7 @@ sub valiate_soap_response {
print_message ($soap_response);
}
print "\n************End of Action*************\n";
return $soap_response->content;
}
sub print_message {
......@@ -52,4 +53,12 @@ sub print_message {
print $_[0]->content . "\n";
}
sub get_test_id_from_response {
my $reponse_string = $_[0];
#print "GOT RESPONSE: $reponse_string \n";
my $test_id = substr $reponse_string, index($reponse_string,"<TestID>") + length("<TestID>"), index($reponse_string,"</TestID>");
my @test_id = $reponse_string =~ m/<TestID>(.*)<\/TestID>/g;
return "@test_id";
}
1;
......@@ -44,6 +44,9 @@ sub print_diagc_start {
print "9. GetNSLookupResult \n";
print "10. GetPingResult \n";
print "11. GetTracerouteResult \n";
print "12. (AUTO) NSLookup \n";
print "13. (AUTO) Ping \n";
print "14. (AUTO) Traceroute \n";
print "x - Exit to main menu \n";
print " ---------------------\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment