Home » Eclipse Projects » Eclipse Titan » Need help to run a DNS test for ttcn3(Need help to run a DNS test for ttcn3)
Need help to run a DNS test for ttcn3 [message #1810327] |
Thu, 08 August 2019 06:27 |
|
Hi everyone, just trying to run a DNS test, but fails.
I'me sure the installation is fine because I can successfully run a helloworld.
This is my code below.
module EtsiDnsTests
{
type record DnsMsg // simplified message structure!
{
DnsMsgKind kind,
charstring question,
charstring answer optional
}
type enumerated DnsMsgKind {e_query, e_response};
type port DnsPort message
{
inout DnsMsg //DNSMessage is allowed to move in and out through this
} with {extension "internal"}
// Note: port types may also allow multiple different message types or restrict the direction
type component DnsClient
{
port DnsPort serverPort //component use only one port for in/out
}
// Note: component types can also define multiple port instances of the same or different port type and declare timers, constants or variables
//template defines the exact message that will be communicated
template DnsMsg m_dnsQuestion( charstring p_question ):=
{
kind := e_query,
question := p_question,
answer := omit // no answer
}
//template defines the exact message that will be communicated
template DnsMsg mw_dnsAnswer( charstring p_answer ):=
{
kind := e_response,
question := ?, // any question ok
answer := p_answer
}
testcase TC_resolveEtsiWww() runs on DnsClient
{
map(self:serverPort, system:serverPort)
timer t_ack;
serverPort.send(m_dnsQuestion("www.etsi.org"));
t_ack.start(1.0);
alt {
[] serverPort.receive(mw_dnsAnswer("172.26.1.17")) {
setverdict (pass);
}
[] serverPort.receive { // any other message
setverdict(fail);
}
[] t_ack.timeout {
setverdict(inconc);
}
}
t_ack.stop;
}
control
{
// Test execution part (optional)
execute(TC_resolveEtsiWww());
}
}
The result is in below
/EtsiDnsTest
TTCN-3 Test Executor (single mode), version CRL 113 200/6 R6A
Execution of control part in module EtsiDnsTests started.
Test case TC_resolveEtsiWww started.
Dynamic test case error: Message cannot be sent to system on internal port serverPort.
Test case TC_resolveEtsiWww finished. Verdict: error
Execution of control part in module EtsiDnsTests finished.
Verdict statistics: 0 none (0.00 %), 0 pass (0.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 1 error (100.00 %).
Test execution summary: 1 test case was executed. Overall verdict: error
seanwl@ubuntu:~/example2/bin$
It would be amazing is anyone have any hint or solution for the Message cannot be sent to system on internal port problem
Best Regard
Sean Kuo
|
|
| |
Re: Need help to run a DNS test for ttcn3 [message #1810590 is a reply to message #1810487] |
Wed, 14 August 2019 03:46 |
|
Hi Jeno,
First of all, thanks a lot for your reply.
Since I couldn't find enough information to correct my dns test code in quick reference card[1] and those etsi ttcn spec files linked in qrc,
I've been switch my research to titan.ProtocolModules.DNS demo code, again.
Everything is fine (thanks to your response on github, again), before execute.
Dynamic test case error: The host name ns1.al.sw.ericsson.se is not valid.
Because of this error, I changed the ns1.al.sw.ericsson.se to www.google.com,
UDP_DNS_PCO.send(t_DNS_NAPTRquery("www.google.com", "6.1.4.6.5.0.5.1.3.4.e164.arpa" ));
but it fail. Well, fail is better than error in execution, But I still need to fix it.
And when I checked the log file, I found out that it is fail because this test case didn't get any reply message from google.
12:13:11.980951 DNS_Demo.ttcn:1085 Sent on UDP_DNS_PCO to 3 @DNS_Mapping.ASP_UDP_DNS : { dnsMessage := { header := { id := 9999, qr := DNS_QUERY (0), opCode := 0, aa := false, tc := false, rd := false, ra := false, z := '000'B, rCode := 0, qdCount := 1, anCount := 0, nsCount := 0, arCount := 0 }, queries := { { qName := "", qType := 35, qClass := 1 } }, answers := { }, nameServerRecords := { }, additionalRecords := { } }, compressDomainNames := false, autoLengthCalc := true, udpAddress := "www.google.com", udpPort := 53 }
12:13:11.981056 DNS_Demo.ttcn:1089 Start timer Tl_idle: 30 s
12:13:42.002653 DNS_Demo.ttcn:1100 Timeout Tl_idle: 30 s
12:13:42.002857 DNS_Demo.ttcn:1101 ...Timeout...
12:13:42.002893 DNS_Demo.ttcn:1102 setverdict(fail): none -> fail
12:13:42.002969 DNS_Demo.ttcn:1106 Stopping PTC with component reference 3.
My question is, would the ns1.al.sw.ericsson.se be available again? Or how do I change the code to test it on google?
I guess it may because the second augment in the function of send()? But it is kind of too complicate to fully understand how the function do to edit t_DNS_NAPTRquery.
it would be wonderful if you throw some advice or hint out for the problem above.
(update AUG 14th 15:27 CST)
As figure 1, I used wireshark to capture packets from the virtual ubuntu system which I run ttcn on it.
seems like that I do send a message to google and google respond, while ttcn test log shows that there is no response received.
Is there any line I need to modify in the DNS_Demo.ttcn file to receive the response?
Best Regards
Sean Kuo :)
[1]http://www.blukaktus.com/TTCN3QRC_viewme.pdf
[Updated on: Wed, 14 August 2019 07:38] Report message to a moderator
|
|
|
Re: Need help to run a DNS test for ttcn3 [message #1810600 is a reply to message #1810590] |
Wed, 14 August 2019 07:35 |
|
Hi Sean,
a few generic observations:
when designing a test across the network, it's a good idea first to have a clear image of the protocol stack involved.
With DNS, transport is over UDP (typically), so you will have to replicate not only the DNS protocol layer, but also
the UDP transport. For this one can conveniently use the UDP test port
https://github.com/eclipse/titan.TestPorts.UDPasp
(These test ports are external, so they will have to be mapped, not connected, as Jeno pointed out)
Also, in the TTCN-3 dialect spoken by Titan all encodings/decoding are explicit, so you will have to make sure you invoke the right functions at the right execution points.
It's always a good idea to understand and check the network functionality before you want to connect to it with an independent means; in your case netcat, nslookup (please see their description) should be sufficient to verify it. DNS servers are everywhere, you don't need any specific one , or the google one, you can use your local one to confront your TTCN-3 code with it.
Lastly, when doing debugging of such a code, it's a good idea to start wireshark and see what's going on on network level.
Otherwise it's very difficult to debug remotely such code as local setup is critical, there's no generic advice that could straight solve it.
Best regards
Elemer
|
|
|
Re: Need help to run a DNS test for ttcn3 [message #1810606 is a reply to message #1810600] |
Wed, 14 August 2019 08:03 |
|
Hi Elemer,
Thanks you very much to reply. :D
Just a couple minutes ago I came up with wireshark idea too!
Although I updated the last message, it may make this thread easier to read if I update here again.
---
As figure 1, I used wireshark to capture packets from the virtual ubuntu system which I run ttcn on it.
Seems like that I do send a message to google and google respond, while ttcn test log shows that there is no response received.
Is there any line I need to modify in the DNS_Demo.ttcn file to receive the response?
---
Here is several response to your reply:
I have linked the UDPasp test port src files according to the error message that make file shows, however, I don't quite understand whats the difference between external and internal ports, because I haven't found any ttcn spec about these extension attribution yet.
Can you explain them for me or offer any key word or links that I can look up to, if you don't mind. :)
Also, I didn't know that DNS server is every where, and I got a local one, before, thanks to you again. But, how do I implement the lines, i.e. which ip should I use to test it?
And yes, I will look up to these new word,netcat, nslookup, you mention above, thank you a lot for point out something I can further my project.
Best Regards
Sean Kuo :)
|
|
|
Re: Need help to run a DNS test for ttcn3 [message #1810611 is a reply to message #1810606] |
Wed, 14 August 2019 10:09 |
|
Hi Sean,
first , internal and external ports:
The execution in a TTCN-3 code happens a separate universe; this universe can communicate with the external world only through test ports:
To be able to simulate complex behaviours, the execution is segmented in components, which don't share any common variable space so they have to communicate via test ports also; these test ports, for obvious reasons, are classified as internal.
In the attached picture one can see a TTCN-3 execution of 3 components A,B,C
A has 2 internal ports, connected to B and C
B has 1 internal port connected to A
C has 1 internal port connected to A
and one external port mapped to the System Under Test -SUT (D)
Titan will take care of the internal communication on the connected ports
but for external ports a code that simulates the appropriate protocol stack
layer or layers will have to be chosen. In your case this is the UDP test port,
which will also have to have pertinent parameters to work properly.
Please read the documentation of the test port.
Other (theorethical ) options could be : TCP port, HTTP port, SIP port etc.
To be continued
BR
Elemer
-
Attachment: TTCN.png
(Size: 22.48KB, Downloaded 427 times)
[Updated on: Wed, 14 August 2019 10:30] Report message to a moderator
|
|
|
Re: Need help to run a DNS test for ttcn3 [message #1810617 is a reply to message #1810611] |
Wed, 14 August 2019 11:28 |
|
Hi Sean,
as for the DNS servers: yes, they are everywhere, most likely even your local wifi router has one, even if just a cache-only server ( returns whatever it finds in the cache or relays the request to a higher order DNS server, which has to be configured; this architecture ensures that load is taken off from servers high in the hierarchy), which will respond you the same as any other server.
I suggest you play around with the nslookup command (works both on Linux and Windows, though slightly differently) and discover the DNS server architecture around you.
My hunch why you don't receive the DNS response is that maybe your UDP port is not properly configured.
Please look into details of configuration in the documentation file;
If still no joy, please upload your code, config file and TTCN-3 logfiles as detailed as possible.
BR
Elemer
[Updated on: Wed, 14 August 2019 16:01] Report message to a moderator
|
|
|
Re: Need help to run a DNS test for ttcn3 [message #1810649 is a reply to message #1810617] |
Thu, 15 August 2019 07:03 |
|
Hi Elemer,
Thanks a lot for your reply,
your explanation is really helpful to understand the mechanism of ttcn,
however, I just been assigned to run a test of http2 protocol on ttcn,
so I have to put DNS test aside temporary.
Maybe someday I will come back and finished this test,
hope that you guys are still available when the times come.
Best Regards
Sean
|
|
| | | | | |
Goto Forum:
Current Time: Sun Dec 22 06:24:09 GMT 2024
Powered by FUDForum. Page generated in 0.04483 seconds
|