Commit bf3d575e authored by garciay's avatar garciay
Browse files

Finalise implementation of TC_DSLITE_AFTR_BF_BV_002

parent 9aac5898
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -119,6 +119,8 @@ module AtsDSLite_Interfaces {
        type component AFTRComponent extends SelfSyncComp {
            /** IPv6 message port */
            port Ipv6Port aftrPort;
            /** IPv4 message port */
            port Ipv4Port ipv4Port;
            /** Timer used for expected received message */
            timer tc_ac:= PX_TAC;
            /** Timer used for unexpected received message */
+10 −0
Original line number Diff line number Diff line
@@ -5,4 +5,14 @@
 */
module AtsDSLite_Pics {
    
    /**
     * @desc The host acts as a B4 device itself
     */
    modulepar boolean PICS_HOST_IS_B4 := false;
    
    /**
     * @desc The host acts as a customer device
     */
    modulepar boolean PICS_HOST_IS_B4_DEVICES := false;
    
} // End of module AtsDSLite_Pics
 No newline at end of file
+187 −56
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ module AtsDSLite_TestCases {
    
    // AtsDSLite
    import from AtsDSLite_TypesAndValues all;
    import from AtsDSLite_Pics all;
    import from AtsDSLite_Pixits all;
    import from AtsDSLite_Functions all;
    import from AtsDSLite_Templates all;
@@ -87,14 +88,14 @@ module AtsDSLite_TestCases {
                    // Start all components
                    vc_dhcpv6Component.start(f_TC_DSLITE_B4_GWA_BV_001_dhcpv6());
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
                    action("the IUT goes online");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -339,7 +340,7 @@ module AtsDSLite_TestCases {
                 * @desc Check that IUT correctly adds the AFTR IPv6 address 
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
                 * PICS Selection: PICS_HOST_IS_B4_DEVICES 
                 * Initial conditions:
                 *  with {
                 *      the IUT having sent a DNS query 
@@ -366,6 +367,10 @@ module AtsDSLite_TestCases {
                    var integer v_host := 0;
                    
                    // Test control
                    if (not(PICS_HOST_IS_B4_DEVICES)) {
                        log("*** " & __SCOPE__ & ": ERROR: 'PICS_HOST_IS_B4_DEVICES' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                    vc_dnsComponent := DNSComponent.create(c_COMP_DNS);
@@ -378,14 +383,14 @@ module AtsDSLite_TestCases {
                    vc_dnsComponent.start(f_TC_DSLITE_B4_GWA_BV_003_dns());
                    vc_hostComponents[v_host].start(f_TC_DSLITE_B4_GWA_BV_003_host());
                    
                    f_serverSyncNClientsAndStop(2, { c_prDone, c_initDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
                    action("the IUT goes online");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(2, { c_prDone, c_initDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -507,7 +512,7 @@ module AtsDSLite_TestCases {
                 * @desc Check that the IUT correctly encapsulates and forwards the IPv4 packets from multiple hosts
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
                 * PICS Selection: PICS_HOST_IS_B4_DEVICES 
                 * Initial conditions:
                 *  with {
                 *      the IUT being configured with a correct AFTR GW IPv6 address
@@ -543,6 +548,10 @@ module AtsDSLite_TestCases {
                    var integer v_host;                                     /** 'for' statement counter */
                    
                    // Test control
                    if (not(PICS_HOST_IS_B4_DEVICES)) {
                        log("*** " & __SCOPE__ & ": ERROR: 'PICS_HOST_IS_B4_DEVICES' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                    vc_aftrComponent := AFTRComponent.create(c_COMP_AFTR);
@@ -576,13 +585,13 @@ module AtsDSLite_TestCases {
                        vc_hostComponents[v_host].start(f_TC_DSLITE_B4_BF_BV_001_host(v_hostAftrDataMsgs[v_host]));
                    } // End of 'for' statement 
                    
                    f_serverSyncNClientsAndStop(v_hostNum + 1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when':  
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(v_hostNum + 1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -753,14 +762,14 @@ module AtsDSLite_TestCases {
                    vc_aftrComponent.start(f_TC_DSLITE_B4_FRAG_BV_001_aftr());
                    vc_hostComponents[0].start(f_TC_DSLITE_B4_FRAG_BV_001_host(v_host));
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
                    action("the IUT in its initial state");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -860,14 +869,14 @@ module AtsDSLite_TestCases {
                    vc_aftrComponent.start(f_TC_DSLITE_B4_FRAG_BV_002_aftr());
                    vc_hostComponents[0].start(f_TC_DSLITE_B4_FRAG_BV_002_host(v_host));
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
                    action("the IUT in its initial state");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -945,7 +954,7 @@ module AtsDSLite_TestCases {
                 * @desc Check that the IUT supports the functionality of DS-lite 1:1 NAT mapping
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
                 * PICS Selection: PICS_HOST_IS_B4 and not PICS_HOST_IS_B4_DEVICES 
                 * Initial conditions:
                 *  with {
                 *      the IUT being properly provisioned and,
@@ -964,11 +973,10 @@ module AtsDSLite_TestCases {
                 *                  containing source address
                 *                      indicating a private IPv4 address 
                 *                  containing destination address
                 *                      indicating a public IPv4 address
                 *          from multiple B4 devices
                 *                      indicating a public IPv4 address from multiple B4 devices
                 *      }
                 *      then {
                 *          the IUT does a 1:1 NAT mapping for each public IPv6 B4 address sourced an,d 
                 *          the IUT does a 1:1 NAT mapping for each public IPv6 B4 address sourced and, 
                 *          the IUT forwards packets to the destination with different IPv4 public addresses
                 *      }
                 *  }
@@ -987,6 +995,10 @@ module AtsDSLite_TestCases {
                    var integer v_host;                                         /** 'for' statement counter */
                    
                    // Test control
                    if (PICS_HOST_IS_B4_DEVICES or not(PICS_HOST_IS_B4)) {
                        log("*** " & __SCOPE__ & ": ERROR: 'PICS_HOST_IS_B4 and not PICS_HOST_IS_B4_DEVICES' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                    vc_aftrComponent := AFTRComponent.create(c_COMP_AFTR);
@@ -1027,13 +1039,13 @@ module AtsDSLite_TestCases {
                        vc_hostComponents[v_host].start(f_TC_DSLITE_AFTR_BF_BV_001_host(v_hostAftrDataMsgs[v_host]));
                    } // End of 'for' statement 
                    
                    f_serverSyncNClientsAndStop(v_hostNum + 1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when':  
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(v_hostNum + 1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -1058,10 +1070,10 @@ module AtsDSLite_TestCases {
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT receives multiple HTML IPv4 packets 
                        // Clause 'when': the IUT receives multiple HTML IPv6 packets 
                        ipv6Port.send(p_host.payload.ipv6Packet); 
                        
                        // Clause 'then':the IUT encapsulates each HTML IPv4 packet unchanged into IPv6 packet 
                        // Clause 'then': the IUT does a 1:1 NAT mapping for each public IPv6 B4 address sourced and, the IUT forwards packets to the destination with different IPv4 public addresses
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success); // Nothing to do
                        
                        // Postamble
@@ -1081,7 +1093,7 @@ module AtsDSLite_TestCases {
                        // Local variables
                        var integer v_hostNum := lengthof(p_hostAftrDataMsgs);  /** Expected number of IPv6 packets to be forwarded */
                        var ResultsList v_results;                              /** List of flags indicating the linked IPv6 packet was forwarded */
                        var Ipv6Packet v_ipv6Packet;                            /** Received IPv6 packet */
                        var Ipv4Packet v_ipv4Packet;                            /** Received IPv4 packet */
                        var integer v_host;                                     /** 'for' statement counter */
                        
                        // Preamble
@@ -1093,22 +1105,15 @@ module AtsDSLite_TestCases {
                        // Test Body
                        // Clause 'when': the IUT receives multiple HTML IPv4 packets 
                        
                        // Clause 'then':the IUT encapsulates each HTML IPv4 packet unchanged into IPv6 packet 
                        // Clause 'then': the IUT does a 1:1 NAT mapping for each public IPv6 B4 address sourced and, 
                        //                the IUT forwards packets to the destination with different IPv4 public addresses
                        v_host := 0;
                        tc_ac.start;
                        alt {
                            [] aftrPort.receive(
                                mdw_generalIpv6_extHdr_dst_ipv6Payload(
                                    c_ipip,
                                    PX_AFTR_B4_ADDRESS,                     // containing destination address indicating IPv6 B4 address
                                    ?,
                                    ?                                       // containing unchanged IPv4 packet
                            )) -> value v_ipv6Packet { 
                            [] ipv4Port.receive(Ipv4Packet:?) -> value v_ipv4Packet { 
                                tc_ac.stop;
                                for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) { 
                                    var template (value) Ipv4Packet v_ipv4Packet;
                                    if (decvalue(oct2bit(v_ipv6Packet.ipv6Payload.octetstringMsg), v_ipv4Packet) == 0) {
                                        if (
                                    if ( // the IUT forwards packets to the destination with different IPv4 public addresses
                                        (v_ipv4Packet.ipv4Hdr.sourceAddress == PX_HOST_V4_LIST_AFTR[v_host].srcAddress) and 
                                        (v_ipv4Packet.ipv4Hdr.destinationAddress != PX_HOST_V4_LIST_AFTR[v_host].dstAddress)
                                    ) {
@@ -1116,7 +1121,6 @@ module AtsDSLite_TestCases {
                                        v_results[v_host] := true;
                                        break;
                                    }
                                    }
                                } // End of 'for' statement 
                                if (lengthof(v_results) == v_hostNum) { // Check current result
                                    log("*** " & __SCOPE__ & ": PASS: All IPv6 packets were forwarded. ***");
@@ -1141,7 +1145,7 @@ module AtsDSLite_TestCases {
                } // End of group f_TC_DSLITE_AFTR_BF_BV_001
                
                /**
                 * @desc CCheck that the IUT supports the functionality of DS-lite 1:n NAT mapping and port translation
                 * @desc Check that the IUT supports the functionality of DS-lite 1:n NAT mapping and port translation
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
@@ -1164,8 +1168,7 @@ module AtsDSLite_TestCases {
                 *                  containing source address
                 *                      indicating a private IPv4 address 
                 *                  containing destination address
                 *                      indicating a public IPv4 address
                 *          from multiple B4 devices
                 *                      indicating a public IPv4 address from multiple B4 devices
                 *      }
                 *      then {
                 *          the IUT does a 1:1 NAT mapping for each public IPv6 B4 address sourced and, 
@@ -1181,25 +1184,63 @@ module AtsDSLite_TestCases {
                testcase TC_DSLITE_AFTR_BF_BV_002() runs on DSLiteComponent system TestAdapter {
                    
                    // Local variables
                    var integer v_hostNum := lengthof(PX_HOST_V4_LIST_AFTR);    /** Expected number of IPv6 packets to be forwarded */
                    var HostAftrDataMsgs v_hostAftrDataMsgs;                    /** Expected of IPv6 packets to be forwarded */
                    var Ipv4Packet v_ipv4Packet;                                /** IPv4 packets to be encapsulated into IPv6 */
                    var integer v_host;                                         /** 'for' statement counter */
                    
                    // Test control
                    if (PICS_HOST_IS_B4_DEVICES or not(PICS_HOST_IS_B4)) {
                        log("*** " & __SCOPE__ & ": ERROR: 'PICS_HOST_IS_B4 and not PICS_HOST_IS_B4_DEVICES' required for executing the TC ***");
                        stop;
                    }
                    
                    // Test component configuration
                   // vc_dhcpv6Component := DHCPv6Component.create(c_COMP_DHCP);
                    vc_aftrComponent := AFTRComponent.create(c_COMP_AFTR);
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                        vc_hostComponents[v_host] := HostComponent.create(c_COMP_HOST & int2str(v_host));
                    } // End of 'for' statement 
                    f_cf01Up_B4();
                    
                    // Test adapter configuration
                    
                    // Start all components
                    // Build the list of the IPv6packet to be sent
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                        f_finalyzeIpv4Packet(
                            m_ipv4Packet_dummy(
                                PX_HOST_V4_LIST_AFTR[v_host].srcAddress,
                                PX_HOST_V4_LIST_AFTR[v_host].dstAddress,
                                m_tcp_packet(
                                    PX_HOST_V4_LIST_AFTR[v_host].srcPort,
                                    PX_HOST_V4_LIST_AFTR[v_host].dstPort,
                                    PX_HOST_V4_LIST_AFTR[v_host].payload
                                )
                            ),
                            v_ipv4Packet
                        );
                        v_hostAftrDataMsgs[v_host].hostId := v_host;
                        v_hostAftrDataMsgs[v_host].payload.ipv6Packet := m_generalIpv6_extHdr_data(
                            c_ipip,
                            PX_AFTR_B4_ADDRESS,                 // containing source address indicating B4 IPv6 address
                            PX_AFTR_GW_ADDRESS,                 // containing destination address indicating IUT GW IPv6 address
                            omit,                               // No extended header
                            bit2oct(encvalue(v_ipv4Packet))     // containing IPv4 payload
                        );
                    } // End of 'for' statement 
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    // Start all components
                    vc_aftrComponent.start(f_TC_DSLITE_AFTR_BF_BV_001_aftr(v_hostAftrDataMsgs));
                    for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) {
                        vc_hostComponents[v_host].start(f_TC_DSLITE_AFTR_BF_BV_001_host(v_hostAftrDataMsgs[v_host]));
                    } // End of 'for' statement 
                    
                    // Test Body
                    // Clause 'when':  
                    action("the IUT in its initial state");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(v_hostNum + 1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
@@ -1207,6 +1248,96 @@ module AtsDSLite_TestCases {
                
                group f_TC_DSLITE_AFTR_BF_BV_002 {
                    
                    /**
                     * @desc Implements multiple hosts from the outside IPv6 network side
                     * @param p_host
                     * @verdict pass on success, inconc on timeout, fail otherwise
                     */
                    function f_TC_DSLITE_AFTR_BF_BV_002_host(in HostAftrDataMsg p_host) runs on HostComponent {
                        
                        // Local variables
                        var HostAftrDataMsg v_HostAftrDataMsg;
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_host();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT receives multiple HTML IPv4 packets 
                        ipv6Port.send(p_host.payload.ipv6Packet);
                        
                        // Clause 'then':the IUT encapsulates each HTML IPv4 packet unchanged into IPv6 packet 
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success); // Nothing to do
                        
                        // Postamble
                        f_postamble_host();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of f_TC_DSLITE_AFTR_BF_BV_002_host
                    
                    /**
                     * @desc Implements the AFTR/B4 side behavior
                     * @param p_hostAftrDataMsgs 
                     * @verdict pass on success, inconc on timeout, fail otherwise
                     */
                    function f_TC_DSLITE_AFTR_BF_BV_002_aftr(HostAftrDataMsgs p_hostAftrDataMsgs) runs on AFTRComponent {
                        
                        // Local variables
                        var integer v_hostNum := lengthof(p_hostAftrDataMsgs);  /** Expected number of IPv6 packets to be forwarded */
                        var ResultsList v_results;                              /** List of flags indicating the linked IPv6 packet was forwarded */
                        var Ipv4Packet v_ipv4Packet;                            /** Received IPv4 packet */
                        var integer v_host;                                     /** 'for' statement counter */
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_aftr();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT receives multiple HTML IPv4 packets 
                        
                        // Clause 'then': the IUT does a 1:n NAT mapping for multiple public IPv6 B4 addresses sourced and, 
                        //                the IUT forwards packets to the destination with the same public IPv4 source address
                        
                        v_host := 0;
                        tc_ac.start;
                        alt {
                            [] ipv4Port.receive(Ipv4Packet:?) -> value v_ipv4Packet { 
                                tc_ac.stop;
                                for (v_host := 0; v_host < v_hostNum; v_host := v_host + 1) { 
                                    if ( // the IUT forwards packets to the destination with the same public IPv4 source address
                                        (v_ipv4Packet.ipv4Hdr.sourceAddress == PX_HOST_V4_LIST_AFTR[v_host].srcAddress) and 
                                        (v_ipv4Packet.ipv4Hdr.destinationAddress == PX_HOST_V4_LIST_AFTR[v_host].dstAddress)
                                    ) {
                                        log("*** " & __SCOPE__ & ": INFO: Receives IPv6 packet #", v_host, ". ***");
                                        v_results[v_host] := true;
                                        break;
                                    }
                                } // End of 'for' statement 
                                if (lengthof(v_results) == v_hostNum) { // Check current result
                                    log("*** " & __SCOPE__ & ": PASS: All IPv6 packets were forwarded. ***");
                                } else {
                                    tc_ac.start;
                                    repeat;
                                }
                            }
                            [] tc_ac.timeout {
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                                log("*** " & __SCOPE__ & ": INCONC: Message was not received in due time. ***");
                            }
                        } // End of 'altstep' statement
                        
                        // Postamble
                        f_postamble_aftr();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of fucntion f_TC_DSLITE_AFTR_BF_BV_002_aftr
                    
                } // End of group f_TC_DSLITE_AFTR_BF_BV_002
                
            } // End of group validBehaviour
@@ -1273,14 +1404,14 @@ module AtsDSLite_TestCases {
                    
                    // Start all components
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Test Body
                    // Clause 'when': 
                    action("the IUT in its initial state");
                    
                    // Clause 'then': Nothing to do, refer to a_default
                    
                    f_serverSyncNClientsAndStop(1, { c_prDone, c_tbDone, c_poDone });
                    
                    // Postamble
                    f_down();
                    
+10 −3

File changed.

Preview size limit exceeded, changes collapsed.