Home » Eclipse Projects » Eclipse Titan » Translation ports vs dual-faced ports part2 (ICMP/IP/Ethernet )
Translation ports vs dual-faced ports part2 [message #1763623] |
Thu, 18 May 2017 02:44  |
Eclipse User |
|
|
|
Dear all,
this time we will resuscitate the example of dual-face port usage published earlier in:
Example of ping (ICMP) over a layer 2 test port with Titan
(Example of ICMP/IP over a LANL2 test port in dual-faced mode with Titan)
https://www.eclipse.org/forums/index.php/t/1068359/
in the form of a translation port use case.
The code presents interest in itself as it describes a modality to directly access the Ethernet layer using the LANL2asp tets port.
The northern part of the translation port (IcmpPort) receives ICMP messages like this:
template PDU_ICMP t_PDU_ICMP_ECho(OCT2 par_seq):=
{
echo:={
type_field:=8,
code:=0,
checksum:='0000'O,
identifier:='0002'O,
sequence_number:=par_seq,
data:='6162636465666768696a6b6c6d6e6f7071727374757677616263646566676869'O
}
}
and translates them to Ethernet frames for the southern end (LANL2asp port).
The test case sends a cycle of ICMP messages (pings) and receives the ICMP echo sent by the kernel IP stack.
Here's the translation port:
//Translation port
type port IcmpPort message map to LANL2asp_PT{
in PDU_ICMP from ASP_v2_LANL2 with dec_ASP_v2_LANL2_Icmp();
out PDU_ICMP to ASP_LANL2 with enc_PDU_ICMP();
in Bool3, Bool4;
in ASP_LANL2_Error, ASP_LANL2_open_result, ASP_v2_LANL2_Error, ASP_LANL2;
}
versus the dual-faced port, somewhat more complicated and difficult to read:
//Dual faced port
type port IcmpPort message {
inout PDU_ICMP;
in Bool3, Bool4;
}
with
{
extension "user LANL2asp_PT
out(
PDU_ICMP -> ASP_LANL2: function(enc_PDU_ICMP)
)
in(
ASP_LANL2 -> PDU_ICMP : function(dec_ASP_LANL2_Icmp),
- : discard;
ASP_LANL2_Error -> - : discard;
ASP_v2_LANL2 -> PDU_ICMP : function(dec_ASP_v2_LANL2_Icmp),
- : discard;
ASP_LANL2_open_result -> - : discard;
ASP_v2_LANL2_Error -> - : discard
)"
}
and one of the functions after :
//------------------------------------------------------------------------------
function dec_ASP_LANL2_Icmp (in ASP_LANL2 par_msg, out PDU_ICMP result ) //return integer
//------------------------------------------------------------------------------
{
var PDU_ICMP v_PDU_ICMP;
var IPv4_packet v_IPv4_packet:= f_IPv4_dec(par_msg.payload);
if (v_IPv4_packet.header.proto ==1)//ICMP
{
v_PDU_ICMP:= f_dec_PDU_ICMP(v_IPv4_packet.payload)
result:=v_PDU_ICMP;
log("ICMP received!!")
port.setstate(0);
return;
}
port.setstate(1);
}
with { extension "prototype(fast)" }
and before (not much difference here):
//------------------------------------------------------------------------------
function dec_ASP_LANL2_Icmp (in ASP_LANL2 par_msg, out PDU_ICMP result ) return integer
//------------------------------------------------------------------------------
{
var PDU_ICMP v_PDU_ICMP;
var IPv4_packet v_IPv4_packet:= f_IPv4_dec(par_msg.payload);
if (v_IPv4_packet.header.proto ==1)//ICMP
{
v_PDU_ICMP:= f_dec_PDU_ICMP(v_IPv4_packet.payload)
result:=v_PDU_ICMP;
log("ICMP received!!")
return 0;
}
return -1;
}
with { extension "prototype(backtrack)" }
Here's a snippet from the log where the message flow can be followed:
2017/May/09 03:05:56.183850 PORTEVENT ICMP2ETH.ttcn:250 Sent on Icmp_PCO to system @ICMP_Types.PDU_ICMP : { echo := { type_field := 8, code := 0, checksum := '0000'O, identifier := '0002'O, sequence_number := '00C9'O, data := '6162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O ("abcdefghijklmnopqrstuvwabcdefghi") } }
2017/May/09 03:05:56.183884 PORTEVENT ICMP2ETH.ttcn:250 The state of the Icmp_PCO port was changed by a setstate operation to unset. Information: by test environment.
2017/May/09 03:05:56.183902 DEBUG ICMP2ETH.ttcn:156 Encoding PDU_ICMP: { echo := { type_field := 8, code := 0, checksum := '0000'O, identifier := '0002'O, sequence_number := '00C9'O, data := '6162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O ("abcdefghijklmnopqrstuvwabcdefghi") } }
2017/May/09 03:05:56.184042 DEBUG ICMP2ETH.ttcn:156 PDU_ICMP after encoding: '08004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O
2017/May/09 03:05:56.184128 DEBUG ICMP2ETH.ttcn:165 Entering f__IPv4__enc__eth
2017/May/09 03:05:56.184193 DEBUG ICMP2ETH.ttcn:165 Encoding IPv4_packet: { header := { ver := 4, hlen := 5, tos := 0, tlen := 10, id := 50000, res := '0'B, dfrag := '0'B, mfrag := '0'B, foffset := 0, ttl := 128, proto := 1, cksum := 0, srcaddr := '7F000001'O, dstaddr := '7F000001'O }, ext_headers := omit, payload := '08004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2017/May/09 03:05:56.184285 DEBUG ICMP2ETH.ttcn:165 Entering Encode_IPv4_extension_headers
2017/May/09 03:05:56.184358 DEBUG ICMP2ETH.ttcn:165 Entering Encode_IPv4_ESP_tails
2017/May/09 03:05:56.184424 DEBUG ICMP2ETH.ttcn:167 Entering f__IPv4__checksum
2017/May/09 03:05:56.184487 DEBUG ICMP2ETH.ttcn:167 Entering Calculate_cksum
2017/May/09 03:05:56.184552 PORTEVENT ICMP2ETH.ttcn:177 The state of the Icmp_PCO port was changed by a setstate operation to translated.
2017/May/09 03:05:56.184575 PORTEVENT ICMP2ETH.ttcn:250 Outgoing message was mapped to @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := 'FFFFFFFFFFFF'O, eth_src_addr := '000C29FBE6D1'O, type_field := '0800'O, payload := '4500003CC35000008001796E7F0000017F00000108004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2017/May/09 03:05:56.184695 TIMEROP ICMP2ETH.ttcn:251 Start timer t_time: 4 s
2017/May/09 03:05:56.194215 PORTEVENT ICMP2ETH.ttcn:252 Message enqueued on Icmp_PCO from system @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := 'FFFFFFFFFFFF'O, eth_src_addr := '005056E0346F'O, type_field := '0806'O, payload := '0001080006040001005056E0346FC0A88B020000000000007F000001000000000000000000000000000000000000'O } id 1
2017/May/09 03:05:56.194285 MATCHING ICMP2ETH.ttcn:254 Matching on port Icmp_PCO succeeded.
2017/May/09 03:05:56.194301 PORTEVENT ICMP2ETH.ttcn:254 Receive operation on port Icmp_PCO succeeded, message from system(): @LANL2asp_Types.ASP_LANL2: { eth_dst_addr := 'FFFFFFFFFFFF'O, eth_src_addr := '005056E0346F'O, type_field := '0806'O, payload := '0001080006040001005056E0346FC0A88B020000000000007F000001000000000000000000000000000000000000'O } id 1
2017/May/09 03:05:56.194316 PORTEVENT ICMP2ETH.ttcn:254 Message with id 1 was extracted from the queue of Icmp_PCO.
2017/May/09 03:05:57.194147 PORTEVENT ICMP2ETH.ttcn:252 Message enqueued on Icmp_PCO from system @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := 'FFFFFFFFFFFF'O, eth_src_addr := '005056E0346F'O, type_field := '0806'O, payload := '0001080006040001005056E0346FC0A88B020000000000007F000001000000000000000000000000000000000000'O } id 2
2017/May/09 03:05:57.194231 MATCHING ICMP2ETH.ttcn:254 Matching on port Icmp_PCO succeeded.
2017/May/09 03:05:57.194249 PORTEVENT ICMP2ETH.ttcn:254 Receive operation on port Icmp_PCO succeeded, message from system(): @LANL2asp_Types.ASP_LANL2: { eth_dst_addr := 'FFFFFFFFFFFF'O, eth_src_addr := '005056E0346F'O, type_field := '0806'O, payload := '0001080006040001005056E0346FC0A88B020000000000007F000001000000000000000000000000000000000000'O } id 2
2017/May/09 03:05:57.194266 PORTEVENT ICMP2ETH.ttcn:254 Message with id 2 was extracted from the queue of Icmp_PCO.
The files
are parts of the port skeleton generated and added to the build for the reasons explained in the previous part.
Code archive and log attached.
Best regards
Elemer
[Updated on: Thu, 18 October 2018 05:56] by Moderator
|
|
| | | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1796622 is a reply to message #1796571] |
Tue, 16 October 2018 10:38   |
Eclipse User |
|
|
|
Hi Elemer,
1. Translation Port
- On the wireshark, I'm sending ICMP from 10.20.30.16 to 10.201.8.41.
- We can see that ICMP is sent in frame 1716, 2738 of the wireshark attachment (see picture)
- On the destination 10.201.8.41, ICMP payload sent is received as TCP (see attached wireshark icmp_dest.pcap) and we are also investigating
Would you know where I can fetch the external function f_IPv4_dec ?
BTW, we are able to ping from 10.20.30.16 to 10.201.8.41 and the ICMP is fine.
Note: (192.168.36.156 is my PC)
2. Dual Port
Same result, why f_IPv4_dec does not decode (see wireshark below) ?
MTC@ttcn-l2: the received ASP_LANL2 msg is'450000344A0B40004006D3140A141E0FC0A834D9270FC47D939A282B7D158A4480100D7E1DCB00000101080A002581B9002581B9'O
MTC@ttcn-l2: f_dec_PDU_ICMP(): Stream before decoding
'270FC47D939A282B7D158A4480100D7E1DCB00000101080A002581B9002581B9'O
MTC@ttcn-l2: f_dec_PDU_ICMP(): Decoded @ICMP_Types.PDU_ICMP: { unknown := '270FC47D939A282B7D158A4480100D7E1DCB00000101080A002581B9002581B9'O }
MTC@ttcn-l2: result is{ unknown := '270FC47D939A282B7D158A4480100D7E1DCB00000101080A002581B9002581B9'O }
MTC@ttcn-l2: ICMP1 received!!
MTC@ttcn-l2: Entering f__IPv4__dec
MTC@ttcn-l2: Entering Decode_IPv4_extension_headers
MTC@ttcn-l2: { header := { ver := 4, hlen := 5, tos := 0, tlen := 86, id := 62438, res := '0'B, dfrag := '1'B, mfrag := '0'B, foffset := 0, ttl := 63, proto := 6, cksum := 10775, srcaddr := 'C0A834D9'O, dstaddr := '0A141E0F'O }, ext_headers := omit, payload := 'C47D270F7D158A44939A282B801800DD64B500000101080A002581B9002581B9210185DE98AD248CDE572D166D6F68616E2049434D50312072656365697665642121'O }
Regards - David
Attachment: ICMP.PNG
(Size: 79.50KB, Downloaded 162 times)
Attachment: icmp_dest.pcap
(Size: 0.94KB, Downloaded 110 times)
[Updated on: Tue, 16 October 2018 13:03] by Moderator
|
|
| |
Re: Translation ports vs dual-faced ports part2 [message #1796659 is a reply to message #1796644] |
Tue, 16 October 2018 22:52   |
Eclipse User |
|
|
|
Hi Elemer,
On similar subject, i am using a dual port for ICMP ping but yet to succeed in recieving an ICMP_EchoReply.
2018/Oct/17 02:28:51.612087 TESTCASE ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:223 Test case tc_ICMP_echo started.
2018/Oct/17 02:28:51.612135 PARALLEL ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:223 Initializing variables, timers and ports of component type ICMP2ETH.MTC inside testcase tc_ICMP_echo.
2018/Oct/17 02:28:51.612176 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:223 Port Icmp_PCO was started.
2018/Oct/17 02:28:51.612247 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:223 Port ASPLan_PCO was started.
2018/Oct/17 02:28:51.612254 PARALLEL ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:223 Component type ICMP2ETH.MTC was initialized.
2018/Oct/17 02:28:51.612264 PARALLEL ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:228 Mapping port mtc:Icmp_PCO to system:ASPLan_PCO.
2018/Oct/17 02:28:51.612600 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:228 LANL2asp__PT_PROVIDER::get_iface_mtu(ens3): MTU is 1450
2018/Oct/17 02:28:51.642026 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:228 Port Icmp_PCO was mapped to system:ASPLan_PCO.
2018/Oct/17 02:28:51.642469 PARALLEL ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:228 Map operation of mtc:Icmp_PCO to system:ASPLan_PCO finished.
2018/Oct/17 02:28:51.642669 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:234 Sent on Icmp_PCO to system @ICMP_Types.PDU_ICMP : { echo := { type_field := 8, code := 0, checksum := '0000'O, identifier := '0002'O, sequence_number := '00C9'O, data := '6162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O ("abcdefghijklmnopqrstuvwabcdefghi") } }
2018/Oct/17 02:28:51.642717 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:135 Encoding PDU_ICMP: { echo := { type_field := 8, code := 0, checksum := '0000'O, identifier := '0002'O, sequence_number := '00C9'O, data := '6162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O ("abcdefghijklmnopqrstuvwabcdefghi") } }
2018/Oct/17 02:28:51.642783 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:135 PDU_ICMP after encoding: '08004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O
2018/Oct/17 02:28:51.642829 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:144 Entering f__IPv4__enc__eth
2018/Oct/17 02:28:51.642849 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:144 Encoding IPv4_packet: { header := { ver := 4, hlen := 5, tos := 0, tlen := 10, id := 50000, res := '0'B, dfrag := '0'B, mfrag := '0'B, foffset := 0, ttl := 128, proto := 1, cksum := 0, srcaddr := 'C0A834D9'O, dstaddr := '0AC90829'O }, ext_headers := omit, payload := '08004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2018/Oct/17 02:28:51.643156 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:144 Entering Encode_IPv4_extension_headers
2018/Oct/17 02:28:51.643245 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:144 Entering Encode_IPv4_ESP_tails
2018/Oct/17 02:28:51.643315 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:146 Entering f__IPv4__checksum
GETTING THE ERROR "Incoming message of type @LANL2asp_Types.ASP_LANL2 could not be handled by the type mapping rules on port Icmp_PCO. The message was discarded." as shown in the log below. How to avoid this error?
2018/Oct/17 02:28:51.644030 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:234 Outgoing message was mapped to @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := '0090FB60E1EC'O, eth_src_addr := 'FA163EFADCED'O, type_field := '0800'O, eth_src_ip_addr := 'C0A834D9'O, eth_dst_ip_addr := '0AC90829'O, payload := '4500003CC350000080016EFDC0A834D90AC9082908004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2018/Oct/17 02:28:51.644137 USER ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:235 mohan I have sent ECHO Request
2018/Oct/17 02:28:51.644165 TIMEROP ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:236 Start timer t_time: 4 s
2018/Oct/17 02:28:51.653162 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:237 Message enqueued on Icmp_PCO from system @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := 'FA163ED742B7'O, eth_src_addr := 'FA163EFADCED'O, type_field := '0800'O, eth_src_ip_addr := <unbound>, eth_dst_ip_addr := <unbound>, payload := '4500004B521840004006CAF00A141E0FC0A834D99824270F820A424E170B7130801800DD1DE200000101080A00AA12AC00AA12A41612000849636D705F50434F0A4153504C616E5F50434F'O } id 1
2018/Oct/17 02:28:51.653214 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:183 Entering f__IPv4__dec
2018/Oct/17 02:28:51.653280 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:183 Entering Decode_IPv4_extension_headers
2018/Oct/17 02:28:51.653314 DEBUG ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:183 { header := { ver := 4, hlen := 5, tos := 0, tlen := 75, id := 21016, res := '0'B, dfrag := '1'B, mfrag := '0'B, foffset := 0, ttl := 64, proto := 6, cksum := 51952, srcaddr := '0A141E0F'O, dstaddr := 'C0A834D9'O }, ext_headers := omit, payload := '9824270F820A424E170B7130801800DD1DE200000101080A00AA12AC00AA12A41612000849636D705F50434F0A4153504C616E5F50434F'O }
2018/Oct/17 02:28:51.653353 USER ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:184 the received ASP_LANL2 msg is'4500004B521840004006CAF00A141E0FC0A834D99824270F820A424E170B7130801800DD1DE200000101080A00AA12AC00AA12A41612000849636D705F50434F0A4153504C616E5F50434F'O
2018/Oct/17 02:28:51.653419 USER ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:194 failed test-case
2018/Oct/17 02:28:51.653438 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:237 Incoming message of type @LANL2asp_Types.ASP_LANL2 could not be handled by the type mapping rules on port Icmp_PCO. The message was discarded.
2018/Oct/17 02:28:51.653461 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:237[b] Message enqueued on Icmp_PCO from system @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := 'FA163EFADCED'O, eth_src_addr := 'FA163ED742B7'O, type_field := '0800'O, eth_src_ip_addr := <unbound>, eth_dst_ip_addr := <unbound>, payload := [/b]'4500004B521840003F06CBF0C0A834D90A141E0F9824270F820A424E170B7130801800DDFE8D00000101080A00AA12AC00AA12A41612000849636D705F50434F0A4153504C616E5F50434F'O } id 1
|
|
|
Re: Translation ports vs dual-faced ports part2 [message #1796660 is a reply to message #1796644] |
Tue, 16 October 2018 22:59   |
Eclipse User |
|
|
|
Hi Elemer,
While using dual ports for testing ICMP echo and echo reply, the mapping is successful between the component port and the system port and also i can view the ICMP Echo request being sent to the Systme Port. But when receiving the Echo Request the followign error messages is seen. I tried various combinations of port types and ASP LANL2, but nothing worked. Can you help me in understanding the meaning of this sentence? Also, i see that the initial message that goes from the component port to the system port is having Proto as 1 but on the reply, from SystemPort, the proto is always 6. What i also understand is for ASP_LANL2 we need not use the config files for adjusting the values and therefore, assume that if we send Proto as 1 we should receive back the proto as 1. Do we need to use any delays, before we shut the ports after the execution of the testcase? May be it takes sometime for the reply to reach, before which probably the ports are shutdown? Could that be a solution? Need your help in understanding the literal meaning of this sentence below.
Incoming message of type @LANL2asp_Types.ASP_LANL2 could not be handled by the type mapping rules on port Icmp_PCO. The message was discarded.
|
|
| | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1796738 is a reply to message #1796736] |
Thu, 18 October 2018 05:48   |
Eclipse User |
|
|
|
Hi David,
here's the quick fix:
change the translation port declaration from :
//Translation port
type port IcmpPort message map to LANL2asp_PT{
in PDU_ICMP from ASP_v2_LANL2 with dec_ASP_v2_LANL2_Icmp();
out PDU_ICMP to ASP_LANL2 with enc_PDU_ICMP();
in Bool3, Bool4;
in ASP_LANL2_Error, ASP_LANL2_open_result, ASP_v2_LANL2_Error, ASP_LANL2;
}
to
//Translation port
type port IcmpPort message map to LANL2asp_PT{
// in PDU_ICMP from ASP_v2_LANL2 with dec_ASP_v2_LANL2_Icmp();
in PDU_ICMP from ASP_LANL2 with dec_ASP_LANL2_Icmp();
out PDU_ICMP to ASP_LANL2 with enc_PDU_ICMP();
in Bool3, Bool4;
in ASP_LANL2_Error, ASP_LANL2_open_result, ASP_v2_LANL2_Error, ASP_v2_LANL2;
}
Here's the reason:
the port is prepared to receive two categories of L2 messages, version 1 and version 2 ; the translation port was assuming with V2 (ASP_V2_LANL2), while you receive v1. (ASP_LANL2)
also , if you add to
function dec_ASP_LANL2_Icmp (in ASP_LANL2 par_msg, out PDU_ICMP result )
if (v_IPv4_packet.header.proto ==1)//ICMP
{
:
:
}
else {
log("Non-ICMP message received!!")
port.setstate(4); //discard
}
this will get rid of unwanted non_ICMP messages
Please test it and tell me the results.
BR
Elemer
|
|
| | | | | | | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1796776 is a reply to message #1796772] |
Thu, 18 October 2018 14:24   |
Eclipse User |
|
|
|
Hi Elemer,
Same result for 3 setup condition: real and localhost and based on ping.
Regards - David
2018/Oct/18 18:03:31.562189 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:139(function:enc_PDU_ICMP) Entering f__IPv4__enc__eth
2018/Oct/18 18:03:31.562197 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:139(function:enc_PDU_ICMP) Encoding IPv4_packet: {
header := {
ver := 4,
hlen := 5,
tos := 0,
tlen := 10,
id := 50000,
res := '0'B,
dfrag := '0'B,
mfrag := '0'B,
foffset := 0,
ttl := 128,
proto := 1,
cksum := 0,
srcaddr := 'C0A834D8'O,
dstaddr := '0AC90829'O
},
ext_headers := omit,
payload := '08004C83000200D76162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O
}
2018/Oct/18 18:03:31.562223 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:139(function:enc_PDU_ICMP) Entering Encode_IPv4_extension_headers
2018/Oct/18 18:03:31.562231 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:139(function:enc_PDU_ICMP) Entering Encode_IPv4_ESP_tails
2018/Oct/18 18:03:31.562239 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:141(function:enc_PDU_ICMP) Entering f__IPv4__checksum
2018/Oct/18 18:03:31.562246 DEBUG_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:141(function:enc_PDU_ICMP) Entering Calculate_cksum
2018/Oct/18 18:03:31.562254 PORTEVENT_SETSTATE ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:151(function:enc_PDU_ICMP) The state of the Icmp_PCO port was changed by a setstate operation to translated.
2018/Oct/18 18:03:31.562279 PORTEVENT_DUALSEND ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:239(testcase:tc_ICMP_echo) Outgoing message was mapped to @LANL2asp_Types.ASP_LANL2 : {
eth_dst_addr := '0090FB60E1EC'O,
eth_src_addr := '307C5E1288C0'O,
type_field := '0800'O,
payload := '4500003CC350000080016EFEC0A834D80AC9082908004C83000200D76162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O
}
2018/Oct/18 18:03:31.562317 TIMEROP_START ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:240(testcase:tc_ICMP_echo) Start timer t_time: 4 s
2018/Oct/18 18:03:35.562340 TIMEROP_TIMEOUT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:245(testcase:tc_ICMP_echo) Timeout t_time: 4 s
2018/Oct/18 18:03:35.562512 PARALLEL_UNQUALIFIED ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:252(testcase:tc_ICMP_echo) Unmapping port mtc:Icmp_PCO from system:Lan_PCO.
[Updated on: Thu, 18 October 2018 14:25] by Moderator
|
|
| |
Re: Translation ports vs dual-faced ports part2 [message #1796782 is a reply to message #1796778] |
Thu, 18 October 2018 15:59   |
Eclipse User |
|
|
|
Hi Elemer,
With your ICMP2ETH.ttcn and our config file, we get the following result.
Based on your logs, we are missing this part below and can it be resolved in 6.4 due to missing libraries ?...it's regarding the second part:
The component itself is the L2 (TTCN-3 executable) component ICMP, that we are currently working with and the SUT Adapter is the port from where the communication from TTCN gets out to the SUT. We have to trigger the run time interfaces by sending the right message from the executable to the SUT Adapter to open the interface of the Adapter towards the SUT.
We are triggering the ICMP Echo Request now with ICMP protocol, which is getting queued so it times out and fails because we assume the connection does not happen to the external SUT and there is no response for the request we send.
Regards - David
2018/Oct/18 03:12:52.337537 PORTEVENT ICMP2ETH.ttcn:248 Message enqueued on Icmp_PCO from system @LANL2asp_Types.ASP_LANL2 : { eth_dst_addr := '000C29FC5671'O, eth_src_addr := '005056C00008'O, type_field := '0800'O, payload := '4500003C30130000800120DBC0A83401C0A8348100005491000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O } id 1
2018/Oct/18 03:12:52.337568 PORTEVENT ICMP2ETH.ttcn:248 The state of the Icmp_PCO port was changed by a setstate operation to unset. Information: by test environment.
2018/Oct/18 03:12:52.337577 DEBUG ICMP2ETH.ttcn:173 Entering f__IPv4__dec
2018/Oct/18 03:12:52.337640 DEBUG ICMP2ETH.ttcn:173 Entering Decode_IPv4_extension_headers
2018/Oct/18 03:12:52.337681 DEBUG ICMP2ETH.ttcn:173 { header := { ver := 4, hlen := 5, tos := 0, tlen := 60, id := 12307, res := '0'B, dfrag := '0'B, mfrag := '0'B, foffset := 0, ttl := 128, proto := 1, cksum := 8411, srcaddr := 'C0A83401'O, dstaddr := 'C0A83481'O }, ext_headers := omit, payload := '00005491000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2018/Oct/18 03:12:52.337734 DEBUG ICMP2ETH.ttcn:177 f_dec_PDU_ICMP(): Stream before decoding: '00005491000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O
2018/Oct/18 03:12:52.337778 DEBUG ICMP2ETH.ttcn:177 f_dec_PDU_ICMP(): Decoded @ICMP_Types.PDU_ICMP: { echo_reply := { type_field := 0, code := 0, checksum := '5491'O, identifier := '0002'O, sequence_number := '00C9'O, data := '6162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O ("abcdefghijklmnopqrstuvwabcdefghi") } }
2018/Oct/18 03:12:52.337827 USER ICMP2ETH.ttcn:179 ICMP received!!
[Updated on: Thu, 18 October 2018 17:04] by Moderator
|
|
| | | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1796927 is a reply to message #1796870] |
Mon, 22 October 2018 09:30   |
Eclipse User |
|
|
|
Hi Elmer,
For the dual port implementation we have the ping and reply working now towards the test system. The problem was with the destination mac. We had to give the GW mac in the destination mac since the test system was in a different subnet from the TTCN itself. Once we changed the destination mac to the GW and the source mac as the ttcn, we were able to ping the test system IP (from the GW) and get a reply back to TTCN . This was the reason why we missed to see the request on the test system side and we assumed, that the interface is not open. This works fine now. This is the same case with the both the translation as well as the dual port.
We need the following clarification:
1. Yes, as you said the reply, seems to be not processed or decoded in both cases(dual-port and translation port). That is, though we see the echo reply in the wireshark, we are not able to decode the message and see the ICMP recevied in the TTCN logs.
2. Since, the dual port implementation is the only one described in the documentation, we just followed it. Do you still suggest to drop it, since the basic L2 test case seems to be fine with the dual port except for the reading the recieved message.
Thanks
Mohan Raj
[Updated on: Mon, 22 October 2018 10:01] by Moderator
|
|
| |
Re: Translation ports vs dual-faced ports part2 [message #1796959 is a reply to message #1796936] |
Tue, 23 October 2018 03:58   |
Eclipse User |
|
|
|
Hi David, Mohan,
I'm sorry , it's quite difficult to debug it based on your feedback. If the dual port implementation works halfway, just keep it, but try to understand the translation port as that will take you further.
I will attach the code I'm using on a Ubuntu 18.04 with the log it generated this morning. All you are supposed to do with it is to change IP and MAC addresses in the config file appropriately.
You can see that the ICMP messages are nicely decoded.
Try to build and run this project form scratch.
The translation port is well described in the standard, see ETSI ES 202 781 V1.6.1 (2018-05) , that's why we did not add it to the documentation, while the dual port is a non standard feature.
the compiler version I'm using is
TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Product number: CRL 113 200/6 R3B
Build date: Mar 21 2018 07:43:09
Compiled with: GCC 7.3.0
Using OpenSSL 1.1.0d 26 Jan 2017
you may have 6.4.0 which should be perfectly fine
BR
Elemer
Attachment: ICMP_20181023.tgz
(Size: 305.43KB, Downloaded 165 times)
Attachment: ICMP.log
(Size: 938.98KB, Downloaded 123 times)
|
|
| | | | | | | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1797077 is a reply to message #1797055] |
Wed, 24 October 2018 16:50   |
Eclipse User |
|
|
|
Hi Elemer,
We have migrated to a multiple interface ASP_v2_LANL2 for ICMP flooding but we have an issue on the interface_id.
In multiple interface what we understand is before sending the ASP_v2_LANL2, the interface needs to be open using open_interface and receive open_result. We basically should pack the interface_name in open_interface and get an interface_id in open_Result., which can be further handled in ASP_v2_LANL2. Is our understanding correct?
If we try directly sending the ASP_v2_LANL2, we end up in this error of interface id in both dual port and translation port. In addition, in dual ports we see a clear error reported in ASP_LANL2_Error "INVALID_INTERFACE_ID".
The above multiple interface scenario is to have multiple source mac's push ping traffic to a single destination. This is the idea behind the above scenario.
Could you help us based on the attached logs and config ?
Regards - David
2018/Oct/24 20:29:19.527422 PORTEVENT ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:278(testcase:tc_ICMP_echo) Outgoing message was mapped to @LANL2asp_Types.ASP_v2_LANL2 : { interface_id := 1, eth_dst_addr := 'FA163E11AA68'O, eth_src_addr := 'FA163EB4D20F'O, type_field := '0800'O, payload := '4500003CC35000008001272B0A141E100A141E0E08004C91000200C96162636465666768696A6B6C6D6E6F7071727374757677616263646566676869'O }
2018/Oct/24 20:29:19.527563 ERROR ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:278(testcase:tc_ICMP_echo) Dynamic test case error: LANL2asp_PT('Lan_PCO'): Invalid inteface id was specified '1'.
2018/Oct/24 20:29:19.527641 VERDICTOP ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:278(testcase:tc_ICMP_echo) setverdict(error): none -> error
2018/Oct/24 20:29:19.527692 EXECUTOR ../TestObjects/Features/L2Net/ICMP2ETH.ttcn:278(testcase:tc_ICMP_echo) Performing error recovery.
[Updated on: Wed, 24 October 2018 16:50] by Moderator
|
|
|
Re: Translation ports vs dual-faced ports part2 [message #1797099 is a reply to message #1797077] |
Thu, 25 October 2018 04:42   |
Eclipse User |
|
|
|
Hi David,
you are absolutely right,
with port_mode := "multiple_interface"
you need to send first a message of type ASP_LANL2_open_interface, containing the interface name as parameter,
to which the port responds with ASP_LANL2_open_result , containing the interface_id to be used from now on.
This can be followed by ASP_v2_LANL2 messages containing the payload.
This assumes appropriate mapping between an upper port say ICMP_PCO able to receive/send ICMP messages ( in fact a composite structure containing ICMP messages and an interface_id , see below)
and the lower LANL2 port.
Problem is , if you want to keep the upper port ICMP only, then you have to resolve the following within the mapping:
-at the reception of the first PDU_ICMP, the above described handshake has to take place
this can be done with the translation port only, with an extension described in the forum as stateful translation port.
So I suggest the following:
-Let the upper port accept both a record consisting of ICMP messages and interface_id and ASP_v2_LANL2 messages
the latter will be mapped directly to the lower port, with no modification
-at start , send from the TTCN-3 code an "open interface" and receive "open_result"
as many times as you think it's needed
save the interface_ids in a table which contains interface_name and interface_id pairs
now you can send a record with PDU_ICMP and an interface_id you want to associate it with
{
PDU_ICMP pdu_icmp,
integer interface_id,
}
based on these two pieces of info you can assemble the IPv4 packet, and then the L2 packet
of course port declarations and translation will have to be modified accordingly
If you browse through my examples of translation ports in this forum you will see similar solutions
Please let me know if this helps
BR
Elemer
|
|
|
Re: Translation ports vs dual-faced ports part2 [message #1797107 is a reply to message #1797099] |
Thu, 25 October 2018 07:18   |
Eclipse User |
|
|
|
Hi,
Do you think we are on the right path to have mutiple mac's ping to the destination? I introduced yesterday icmp type fiels for open_interface and open result and added two fucnctions to send and receive these messges. I can see in logs that i am able to send the open_interface message but still not successful in receive the open_Result. THis is in dual_ports, as i am dealing with that.
1. Is there a way to pass parameters between funcitons without using module parameters? I am tring to pass the interface id received in open_result to the lanl2 echo. Since, without this, i am receiveing INVALID_INTERFACE_ID, since i am hard coding it now.
2. Iam attaching the code part currently for your review. Kindly review the same.
As of now, i am not receiving the Open_Result. Instead i am receiving LAN_L2_Error. I am not sure how after sending the open_interface control goes to the ASP_LANL2 message sending part, since according to the code, it should wait for receiving the open_result. Or is it because, it is receiving LAN_L2_Error message, which it discards and goes to send LANL2_echo_message? If we are able to receive the open_result and pass the paramter to the LANL2 message, we should be able to ping using the changed SOURCE mac addr which we are not able to succeed currently with single interface implementation.
Need your views on this.
Best Regards, Mohan Raj
[Updated on: Thu, 25 October 2018 07:45] by Moderator
|
|
| | | |
Re: Translation ports vs dual-faced ports part2 [message #1797182 is a reply to message #1797167] |
Sat, 27 October 2018 02:30   |
Eclipse User |
|
|
|
Hi David,
you can put any source address in the TTCN-3 code or config file, there's no restriction here.
But if you put in something that does not match the network , that is the HW of the network interface , it will not work.
So if you thought that somehow Titan will create virtual interfaces, that will not happen.
If you want to work with multiple interfaces, you will have to add as many physical interfaces as needed or
somehow create virtual interfaces , but that's beyond my expertise.
Mohan:
1. I dont send close interface. Hope that is fine.
Depends. As I suggested , you should open an interface in the beginning, than send an unlimited number of ICMP messages. If the execution terminates here,
the interface will be closed; however it's more elegant to close it manually.
2. In the code i always have interface id as 0 sent in ASP_v2_LANL2 messages as interface id. I want to change them for each interface id. I am missing something here. Any indications would help.
That's definitely not the way to go. Let's assume you have 4 interfaces say ens1, ens2, ens3, ens4
Than you should send 4 open messages and you should receive 4 interface id's say 0,1,2,3
You need to build a table that associates if name with id
e.g.
ens1 3
ens2 1
ens3 0
ens4 2
and should use these id's when sending ICMP; you should also be aware all the time to which interface you send the ICMP as the reply should be returned on that interface
3. Pointers to documentation on multiple interface as the documentation i have seen so far, has very minimal documentation
you should look into the linux documentation specific to you environment plus standard networking info.
That is not TTCN specific.
BR
Elemer
|
|
| | | | | | | | | | | | | |
Re: Translation ports vs dual-faced ports part2 [message #1797823 is a reply to message #1797567] |
Tue, 06 November 2018 22:24   |
Eclipse User |
|
|
|
Thanks Elemer, for your clarification. But i doubt, whether the implementation supports it as i did the changes you suggested and it looks like the whole thing reboots each time and it looses the virtual interface. So no use, in this.
Getting into the issue of MAC flooding further, what i clearly see is, we do not have ARP messages for the amount of PINGs, even if we change the MAC address (via RND MAC function). This could mean that, we might have to construct ARP Request and ARP reply for the change of Source MAC and send/ recieve the same to keep the result in ARP cache.
Do you think, the above would work if the port is still kept PDU_ICMP and if we additional type fileds, for ARP_Request and Reply each time, we change the source???? Or do you suggest anyother ways to do this?
May be this what is missing. Because, i do not see the ARP request and reply at all if the MAC changes.
Anyway, i will try this tomorrow and check if this triggers anything which we require for MAC flooding.'
Thanks
Mohan Raj
|
|
| | | |
Re: Translation ports vs dual-faced ports part2 [message #1797865 is a reply to message #1797852] |
Wed, 07 November 2018 11:10   |
Eclipse User |
|
|
|
Hi Elemer,
1) When we add a oversize payload > 1450, TTCN throws a dynamic error as followed:
Dynamic test case error: LANL2asp_PT('Lan_PCO'): Length of 'payload' is not of correct size (expected: 46-1450, given: 1468 byte). (Resource temporarily unavailable)
setverdict(error): none -> error
I have coded this to pass the intended fault in TTCN, but is there a cleaner catch ?
var charstring error_message := " ...dynamic string error...";
@try {
Icmp_PCO.send(t_PDU_ICMP_ECho(v_cycle));
}
@catch (msg) {
if (not match(msg, error_message)) {
setverdict(fail, "Expected error is: ", dte_message, ", got: ", msg);
}
}
2) One more thing for undersize payload < 46 byte
it seems that v_ASP_LANL2.payload always keep it to 46 bytes even you lower the data under 46 byte.
Regards - David
[Updated on: Wed, 07 November 2018 16:54] by Moderator
|
|
| | | | | | | | | | | | | | | | | | | | | | | | | | |
Goto Forum:
Current Time: Sun Jul 13 01:29:15 EDT 2025
Powered by FUDForum. Page generated in 0.17975 seconds
|