Loading ttcn/AtsDSlite/AtsDSLite_Functions.ttcn3 +100 −30 Original line number Diff line number Diff line Loading @@ -8,39 +8,39 @@ module AtsDSLite_Functions { altstep a_shutdown; const c_prDone, c_tbDone, c_poDone c_prDone, c_tbDone, c_poDone; }; // LibIpv6 import from LibIpv6_Interface_Templates all; import from LibIpv6_Interface_TypesAndValues all; import from LibIpv6_CommonRfcsDhcp_TypesAndValues all; // DSLite import from AtsDSLite_Interfaces { type DSLiteComponent, TestAdapter, AFTRComponent, HostComponent, DHCPv6Component, DNSComponent DHCPv6Component, DNSComponent; }; group initialiseFunctions { function f_cf01Up_B4( in AFTRComponent p_aftrComponent, in HostComponent p_hostComponent, in DHCPv6Component p_dhcpv6Component, in DNSComponent p_dnsComponent ) runs on DSLiteComponent { function f_cf01Up_B4() runs on DSLiteComponent { // Connect port if (p_aftrComponent != null) { connect(p_aftrComponent:aftrPort, self:aftrPort); if (vc_aftrComponent != null) { connect(vc_aftrComponent:aftrPort, self:aftrPort); } if (p_hostComponent != null) { connect(p_hostComponent:ipv6Port, self:ipv6HostPort); connect(p_hostComponent:ipv4Port, self:ipv4HostPort); if (vc_hostComponent != null) { connect(vc_hostComponent:ipv6Port, self:ipv6HostPort); connect(vc_hostComponent:ipv4Port, self:ipv4HostPort); } if (p_dhcpv6Component != null) { connect(p_dhcpv6Component:dhcpv6Port, self:dhcpv6Port); if (vc_dhcpv6Component != null) { connect(vc_dhcpv6Component:dhcpv6Port, self:dhcpv6Port); } if (p_dnsComponent != null) { connect(p_dnsComponent:dnsPort, self:dnsPort); if (vc_dnsComponent != null) { connect(vc_dnsComponent:dnsPort, self:dnsPort); } // Map ports Loading Loading @@ -73,7 +73,7 @@ module AtsDSLite_Functions { } // End of group uninitialiseFunctions group preambuleFunctions { group preambleFunctions { function f_preamble_dhcpv6() runs on DHCPv6Component { // Connect synchronisation ports Loading @@ -87,9 +87,9 @@ module AtsDSLite_Functions { } // End of function f_preamble_dns } // End of group preambuleFunctions } // End of group preambleFunctions group postambuleFunctions { group postambleFunctions { function f_postamble_dhcpv6() runs on DHCPv6Component { // Nothing to do Loading @@ -99,7 +99,7 @@ module AtsDSLite_Functions { // Nothing to do } // End of function f_postamble_dns } // End of group postambuleFunctions } // End of group postambleFunctions group globalSteps { Loading @@ -107,7 +107,77 @@ module AtsDSLite_Functions { * @desc */ altstep a_default() runs on DSLiteComponent { [] ipv4Port.receive { // Unsollicited messages var Ipv6Packet v_ipv6Pkt; var Ipv4Packet v_ipv4Pkt; var DHCPv6Msg v_dhcpMsg; // var DNSMsg v_dnsMsg; [] ipPort.receive(mw_ipPkt) -> value v_ipv6Pkt { if (ispresent(v_ipv6Pkt.ipv6Payload)) { if (ischosen(v_ipv6Pkt.ipv6Payload.udpMsg) and ispresent(v_ipv6Pkt.ipv6Payload.udpMsg.data)) { //Shall DHCP be handled? if (vc_dhcpv6Component!=null and v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dhcpv6ClientPort, 2) and v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dhcpv6ServerPort, 2)) { if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dhcpMsg)!=0) { dhcpv6Port.send(v_dhcpMsg); repeat; } else { log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DHCPv6 message ***"); f_selfOrClientSyncAndVerdict("error", e_error); } } //Shall DNS be handled? //TODO ports??? // if (vc_dnsComponent!=null and v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dnsClientPort, 2) // and v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dnsServerPort, 2)) { // if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dnsMsg)!=0) { // dnsPort.send(v_dnsMsg); // repeat; // } // else { // log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DNS message ***"); // f_selfOrClientSyncAndVerdict("error", e_error); // } // } } //TODO TCP??? //TODO addresses??? // if (vc_aftrComponent!=null and v_ipv6Pkt.ipv6Hdr.destinationAddress==AFTR_ADDRESS) { // aftrPort.send(v_ipv6Pkt); // repeat; // } // if (vc_hostComponent!=null and v_ipv6Pkt.ipv6Hdr.destinationAddress==HOST_ADDRESS) { // ipv6HostPort.send(v_ipv6Pkt); // repeat; // } //any other cases are handled as error log("*** " & __SCOPE__ & "ERROR: Could not successfully dispatch received message ***"); f_selfOrClientSyncAndVerdict("error", e_error); } } [] ipv4HostPort.receive(Ipv4Packet:?) -> value v_ipv4Pkt { ipv4Port.send(v_ipv4Pkt); repeat; } [] ipv6HostPort.receive(Ipv6Packet:?) -> value v_ipv6Pkt { ipPort.send(v_ipv6Pkt); repeat; } [] aftrPort.receive(Ipv6Packet:?) -> value v_ipv6Pkt { ipPort.send(v_ipv6Pkt); repeat; } [] dhcpv6Port.receive(DHCPv6Msg:?) -> value v_dhcpMsg { // f_sendDhcpv6Msg(v_dhcpMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort); repeat; } // [] dnsPort.receive(DnsMsg:?) -> value v_dnsMsg { // f_sendDnsMsg(v_dnsMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort); // repeat; // } [] ipv4Port.receive { // Unsolicited messages tc_ac.stop; log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv4 message, process it as an error ***"); f_selfOrClientSyncAndVerdict("error", e_error); Loading ttcn/AtsDSlite/AtsDSLite_Interfaces.ttcn3 +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ module AtsDSLite_Interfaces { * @member dnsPort */ type component DSLiteComponent extends LibIpv6Node { var AFTRComponent vc_aftrComponent := null; var HostComponent vc_hostComponent := null; var DHCPv6Component vc_dhcpv6Component := null; var DNSComponent vc_dnsComponent := null; /** DHCPv6 port for DHCPv6Msg message exchanges */ port DHCPv6Port dhcpv6Port; /** DNSv4 port for DNSv4Msg message exchanges */ Loading ttcn/AtsDSlite/AtsDSLite_TestCases.ttcn3 +5 −10 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ module AtsDSLite_TestCases { group b4Sut { group gatewayAssignement { group gatewayAssignment { group validBehaviour { Loading Loading @@ -63,24 +63,20 @@ module AtsDSLite_TestCases { // Local variables var boolean v_exitLoop := false; var AFTRComponent v_aftrComponent := null; // AFTRComponent.create("AFTR"); var HostComponent v_hostComponent := null; // HostComponent.create("Host"); var DHCPv6Component v_dhcpv6Component := DHCPv6Component.create("DHCPv6"); var DNSComponent v_dnsComponent := null; // DNSComponent.create("DNS"); var DHCPv6Msg v_dHCPv6Msg; vc_dhcpv6Component := DHCPv6Component.create("DHCPv6"); // Test control // Test component configuration // TODO f_cf01Up_B4(v_dhcpv6Component, v_dnsComponent); f_cf01Up_B4(v_aftrComponent, v_hostComponent, v_dhcpv6Component, v_dnsComponent); f_cf01Up_B4(); // Test adapter configuration // Start all components v_dhcpv6Component.start(f_TC_DSLITE_B4_GWA_BV_001_dhcpv6()); // TODO activate(a_blabla()); f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone }); // // Preamble Loading Loading @@ -136,7 +132,6 @@ module AtsDSLite_TestCases { // } // End of 'while' statement // Postamble f_selfOrClientSyncAndVerdict(c_poDone, e_success); f_cf01Down_B4(); } // End of testcase TC_DSLITE_B4_GWA_BV_001 Loading Loading
ttcn/AtsDSlite/AtsDSLite_Functions.ttcn3 +100 −30 Original line number Diff line number Diff line Loading @@ -8,39 +8,39 @@ module AtsDSLite_Functions { altstep a_shutdown; const c_prDone, c_tbDone, c_poDone c_prDone, c_tbDone, c_poDone; }; // LibIpv6 import from LibIpv6_Interface_Templates all; import from LibIpv6_Interface_TypesAndValues all; import from LibIpv6_CommonRfcsDhcp_TypesAndValues all; // DSLite import from AtsDSLite_Interfaces { type DSLiteComponent, TestAdapter, AFTRComponent, HostComponent, DHCPv6Component, DNSComponent DHCPv6Component, DNSComponent; }; group initialiseFunctions { function f_cf01Up_B4( in AFTRComponent p_aftrComponent, in HostComponent p_hostComponent, in DHCPv6Component p_dhcpv6Component, in DNSComponent p_dnsComponent ) runs on DSLiteComponent { function f_cf01Up_B4() runs on DSLiteComponent { // Connect port if (p_aftrComponent != null) { connect(p_aftrComponent:aftrPort, self:aftrPort); if (vc_aftrComponent != null) { connect(vc_aftrComponent:aftrPort, self:aftrPort); } if (p_hostComponent != null) { connect(p_hostComponent:ipv6Port, self:ipv6HostPort); connect(p_hostComponent:ipv4Port, self:ipv4HostPort); if (vc_hostComponent != null) { connect(vc_hostComponent:ipv6Port, self:ipv6HostPort); connect(vc_hostComponent:ipv4Port, self:ipv4HostPort); } if (p_dhcpv6Component != null) { connect(p_dhcpv6Component:dhcpv6Port, self:dhcpv6Port); if (vc_dhcpv6Component != null) { connect(vc_dhcpv6Component:dhcpv6Port, self:dhcpv6Port); } if (p_dnsComponent != null) { connect(p_dnsComponent:dnsPort, self:dnsPort); if (vc_dnsComponent != null) { connect(vc_dnsComponent:dnsPort, self:dnsPort); } // Map ports Loading Loading @@ -73,7 +73,7 @@ module AtsDSLite_Functions { } // End of group uninitialiseFunctions group preambuleFunctions { group preambleFunctions { function f_preamble_dhcpv6() runs on DHCPv6Component { // Connect synchronisation ports Loading @@ -87,9 +87,9 @@ module AtsDSLite_Functions { } // End of function f_preamble_dns } // End of group preambuleFunctions } // End of group preambleFunctions group postambuleFunctions { group postambleFunctions { function f_postamble_dhcpv6() runs on DHCPv6Component { // Nothing to do Loading @@ -99,7 +99,7 @@ module AtsDSLite_Functions { // Nothing to do } // End of function f_postamble_dns } // End of group postambuleFunctions } // End of group postambleFunctions group globalSteps { Loading @@ -107,7 +107,77 @@ module AtsDSLite_Functions { * @desc */ altstep a_default() runs on DSLiteComponent { [] ipv4Port.receive { // Unsollicited messages var Ipv6Packet v_ipv6Pkt; var Ipv4Packet v_ipv4Pkt; var DHCPv6Msg v_dhcpMsg; // var DNSMsg v_dnsMsg; [] ipPort.receive(mw_ipPkt) -> value v_ipv6Pkt { if (ispresent(v_ipv6Pkt.ipv6Payload)) { if (ischosen(v_ipv6Pkt.ipv6Payload.udpMsg) and ispresent(v_ipv6Pkt.ipv6Payload.udpMsg.data)) { //Shall DHCP be handled? if (vc_dhcpv6Component!=null and v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dhcpv6ClientPort, 2) and v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dhcpv6ServerPort, 2)) { if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dhcpMsg)!=0) { dhcpv6Port.send(v_dhcpMsg); repeat; } else { log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DHCPv6 message ***"); f_selfOrClientSyncAndVerdict("error", e_error); } } //Shall DNS be handled? //TODO ports??? // if (vc_dnsComponent!=null and v_ipv6Pkt.ipv6Payload.udpMsg.sourcePort == int2oct(c_dnsClientPort, 2) // and v_ipv6Pkt.ipv6Payload.udpMsg.destPort == int2oct(c_dnsServerPort, 2)) { // if (decvalue(oct2bit(valueof(v_ipv6Pkt.ipv6Payload.udpMsg.data)), v_dnsMsg)!=0) { // dnsPort.send(v_dnsMsg); // repeat; // } // else { // log("*** " & __SCOPE__ & "ERROR: Could not successfully decode the DNS message ***"); // f_selfOrClientSyncAndVerdict("error", e_error); // } // } } //TODO TCP??? //TODO addresses??? // if (vc_aftrComponent!=null and v_ipv6Pkt.ipv6Hdr.destinationAddress==AFTR_ADDRESS) { // aftrPort.send(v_ipv6Pkt); // repeat; // } // if (vc_hostComponent!=null and v_ipv6Pkt.ipv6Hdr.destinationAddress==HOST_ADDRESS) { // ipv6HostPort.send(v_ipv6Pkt); // repeat; // } //any other cases are handled as error log("*** " & __SCOPE__ & "ERROR: Could not successfully dispatch received message ***"); f_selfOrClientSyncAndVerdict("error", e_error); } } [] ipv4HostPort.receive(Ipv4Packet:?) -> value v_ipv4Pkt { ipv4Port.send(v_ipv4Pkt); repeat; } [] ipv6HostPort.receive(Ipv6Packet:?) -> value v_ipv6Pkt { ipPort.send(v_ipv6Pkt); repeat; } [] aftrPort.receive(Ipv6Packet:?) -> value v_ipv6Pkt { ipPort.send(v_ipv6Pkt); repeat; } [] dhcpv6Port.receive(DHCPv6Msg:?) -> value v_dhcpMsg { // f_sendDhcpv6Msg(v_dhcpMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort); repeat; } // [] dnsPort.receive(DnsMsg:?) -> value v_dnsMsg { // f_sendDnsMsg(v_dnsMsg, TODO src addr, TODO dst addr, c_dhcpv6ServerPort, c_dhcpv6ClientPort); // repeat; // } [] ipv4Port.receive { // Unsolicited messages tc_ac.stop; log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv4 message, process it as an error ***"); f_selfOrClientSyncAndVerdict("error", e_error); Loading
ttcn/AtsDSlite/AtsDSLite_Interfaces.ttcn3 +5 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,11 @@ module AtsDSLite_Interfaces { * @member dnsPort */ type component DSLiteComponent extends LibIpv6Node { var AFTRComponent vc_aftrComponent := null; var HostComponent vc_hostComponent := null; var DHCPv6Component vc_dhcpv6Component := null; var DNSComponent vc_dnsComponent := null; /** DHCPv6 port for DHCPv6Msg message exchanges */ port DHCPv6Port dhcpv6Port; /** DNSv4 port for DNSv4Msg message exchanges */ Loading
ttcn/AtsDSlite/AtsDSLite_TestCases.ttcn3 +5 −10 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ module AtsDSLite_TestCases { group b4Sut { group gatewayAssignement { group gatewayAssignment { group validBehaviour { Loading Loading @@ -63,24 +63,20 @@ module AtsDSLite_TestCases { // Local variables var boolean v_exitLoop := false; var AFTRComponent v_aftrComponent := null; // AFTRComponent.create("AFTR"); var HostComponent v_hostComponent := null; // HostComponent.create("Host"); var DHCPv6Component v_dhcpv6Component := DHCPv6Component.create("DHCPv6"); var DNSComponent v_dnsComponent := null; // DNSComponent.create("DNS"); var DHCPv6Msg v_dHCPv6Msg; vc_dhcpv6Component := DHCPv6Component.create("DHCPv6"); // Test control // Test component configuration // TODO f_cf01Up_B4(v_dhcpv6Component, v_dnsComponent); f_cf01Up_B4(v_aftrComponent, v_hostComponent, v_dhcpv6Component, v_dnsComponent); f_cf01Up_B4(); // Test adapter configuration // Start all components v_dhcpv6Component.start(f_TC_DSLITE_B4_GWA_BV_001_dhcpv6()); // TODO activate(a_blabla()); f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone }); // // Preamble Loading Loading @@ -136,7 +132,6 @@ module AtsDSLite_TestCases { // } // End of 'while' statement // Postamble f_selfOrClientSyncAndVerdict(c_poDone, e_success); f_cf01Down_B4(); } // End of testcase TC_DSLITE_B4_GWA_BV_001 Loading