Commit b97cb12a authored by garciay's avatar garciay
Browse files

Initial interface definition

Initial configuration
parent 0d639f5f
Loading
Loading
Loading
Loading
+143 −0
Original line number Diff line number Diff line
module AtsDSLite_Functions {
    
    // LibCommon
    import from LibCommon_Sync {
        function 
            f_connect4SelfOrClientSync, 
            f_selfOrClientSyncAndVerdict;
        altstep 
            a_shutdown;
        const 
            c_prDone, c_tbDone, c_poDone
    };
        
    // DSLite
    import from AtsDSLite_Interfaces {
        type 
            DSLiteComponent, TestAdapter, 
            AFTRComponent, HostComponent,
            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 {
                    
            // Connect port
            if (p_aftrComponent != null) { 
                connect(p_aftrComponent:aftrPort, self:aftrPort);
            }
            if (p_hostComponent != null) { 
                connect(p_hostComponent:ipv6Port, self:ipv6HostPort); 
                connect(p_hostComponent:ipv4Port, self:ipv4HostPort); 
            } 
            if (p_dhcpv6Component != null) { 
                connect(p_dhcpv6Component:dhcpv6Port, self:dhcpv6Port);         
            } 
            if (p_dnsComponent != null) { 
                connect(p_dnsComponent:dnsPort, self:dnsPort);
            }
            
            // Map ports
            map(self:ipPort, system:ipPort);
            map(self:ipv4Port, system:ipv4Port);
            
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
            // Default activation
            activate(a_default());
        } // End of function f_cf01Up_B4
        
    } // End of group initialiseFunctions
    
    group uninitialiseFunctions {
        
        function f_cf01Down_B4() runs on DSLiteComponent {       
            // Unmap all ports
            unmap(all component: all port);
            // Stop components
            all component.stop;
            // Wait for all components terminated
            all component.done;
            // Disconnect all ports
            disconnect(all component: all port);    
            // De-activation
            deactivate;
        } // End of function f_cf01Down_B4
        
    } // End of group uninitialiseFunctions
    
    group preambuleFunctions {
        
        function f_preamble_dhcpv6() runs on DHCPv6Component {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_dhcpv6
        
        function f_preamble_dns() runs on DHCPv6Component {
            // Connect synchronisation ports
            f_connect4SelfOrClientSync();
            
        } // End of function f_preamble_dns
        
    } // End of group preambuleFunctions
    
    group postambuleFunctions {
        
        function f_postamble_dhcpv6() runs on DHCPv6Component {
            // Nothing to do
        } // End of function f_postamble_dhcpv6
        
        function f_postamble_dns() runs on DHCPv6Component {
            // Nothing to do
        } // End of function f_postamble_dns
        
    } // End of group postambuleFunctions
        
    group globalSteps {
        
        /**
         * @desc 
         */
        altstep a_default() runs on DSLiteComponent {
            [] ipv4Port.receive  { // Unsollicited messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "ERROR: Received an unexpected IPv4 message, process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] tc_wait.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] any timer.timeout {
                log("*** " & __SCOPE__ & "ERROR: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }   
            [] a_shutdown() {
                // FIXME Should something be done here?
                log("*** " & __SCOPE__ & "TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;   
            }
        } // End of altstep a_default 
        
        altstep a_ipv6UnsupportedMessages() runs on DSLiteComponent {
            [] ipPort.receive  { // Unsupported IPv6 messages
                tc_ac.stop;
                log("*** " & __SCOPE__ & "INFO: Received an unexpected IPv6 message, process it as an error ***");
            }
        } // End of altstep a_ipv6UnsupportedMessages 
        
    } // End of group globalSteps
    
} // End of module AtsDSLite_Functions
+114 −0
Original line number Diff line number Diff line
/*
 *  @author     STF 440
 *  @version    $Id$
 *  @desc       This module defines the ATS interface
 */
module AtsDSLite_Interfaces {
    
    // LibCommon
    import from LibCommon_Sync {
        type SelfSyncComp
    };
    import from LibCommon_Time {
        modulepar PX_TAC, PX_TNOAC, PX_TWAIT
    };
    
    // LibIPv6
    import from LibIpv6_Interface_TypesAndValues {
        type 
            LibIpv6Node,
            Ipv4Port, Ipv6Port 
    };
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues {
        type 
            DHCPv6Msg 
    };
    
    group mtcPorts {
    
        /**
         * @desc 
         * @member dhcpv6Port
         * @member dnsPort
         */
        type component DSLiteComponent extends LibIpv6Node {
            /** DHCPv6 port for DHCPv6Msg message exchanges */
            port DHCPv6Port dhcpv6Port;
            /** DNSv4 port for DNSv4Msg message exchanges */
            port DNSv4Port dnsPort;

            port Ipv6Port aftrPort;
            
            port Ipv6Port ipv6HostPort;
            port Ipv4Port ipv4HostPort;   
        } // End of component DSLiteComponent
                    
        /**
         * @desc 
         * @member ipv4Port
         * @member ipPort
         */
        type component TestAdapter {
            /** IPv4 port. Only UDP protocol is used */
            port Ipv4Port ipv4Port;
            /** IPv6 port. Only UDP protocol is used */
            port Ipv6Port ipPort;
        } // End of type TestAdapter
    
    } // End of group mtcPorts
    
    group componentPorts {
    
        type port DHCPv6Port message {
            inout DHCPv6Msg
        } // End of type DHCPv6Port
        
        type port DNSv4Port message {
            inout all// TODO DNS_MSG
        } // End of type DNSPort
  
        type component HostComponent extends SelfSyncComp {
            port Ipv6Port ipv6Port;   
            port Ipv4Port ipv4Port;   
            /** Timer used for expected received message */
            timer tc_ac:= PX_TAC;
            /** Timer used for unexpected received message */
            timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
            timer tc_twait:= PX_TWAIT;
       }
         
        type component AFTRComponent extends SelfSyncComp {
            port Ipv6Port aftrPort;   
            /** Timer used for expected received message */
            timer tc_ac:= PX_TAC;
            /** Timer used for unexpected received message */
            timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
            timer tc_twait:= PX_TWAIT;
       }
         
        type component DHCPv6Component extends SelfSyncComp {
            /** DHCPv6 port */
            port DHCPv6Port dhcpv6Port;
            /** Timer used for expected received message */
            timer tc_ac:= PX_TAC;
            /** Timer used for unexpected received message */
            timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
            timer tc_wait:= PX_TWAIT;
        } // End of component DHCPv6Component
        
        type component DNSComponent extends SelfSyncComp {
            port DNSv4Port dnsPort;
            /** Timer used for expected received message */
            timer tc_ac:= PX_TAC;
            /** Timer used for unexpected received message */
            timer tc_noac:= PX_TNOAC;
            /** Timer used for receive meceige */
            timer tc_twait:= PX_TWAIT;
        } // End of component DNSComponent

    } // End of group componentPorts
        
} // End of module AtsDSLite_Interfaces
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
module AtsDSLite_Pixits {
    
    // LibCommon
    
    
} // End of module AtsDSLite_Pixits
 No newline at end of file
+74 −0
Original line number Diff line number Diff line
module AtsDSLite_Templates {
    
    // LibIPv6
    import from LibIpv6_Interface_TypesAndValues {
        type UdpPacket;
        const c_udpHdr
    };
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues {
        type DHCPv6Msg, MsgType; 
    };
    import from LibIpv6_Interface_Templates {
        template mw_ipHdr_nextHdr 
    };
    
    group dhcpv6Templates {
        
        
        
        /**
         *  @desc   UDP/DHCPv6 receive packet
         */
        template UdpPacket mw_udpDhcpv6Pkt := {
            ipv6Hdr := mw_ipHdr_nextHdr(c_udpHdr),
            extHdrList := *,
            ipv6Payload := { 
                udpMsg := {
                    sourcePort:= ?,
                    destPort:= ?,
                    msgLength:= ?,
                    checksum:=?,
                    data := ?
                }
            }
        } // End of template mw_udpDhcpv6Pkt
        
        
        group dhcpv6DummySendTemplates {
            
            
            
            
            
        } // End of group dhcpv6DummySendTemplates
        
        group dhcpv6DummyRecvTemplates {
            
            
          /**
           * @desc Genercic receive DHCP Client/Server message
           * @reference http://tools.ietf.org/html/rfc3315#section-6
           */  
          template (present) DHCPv6Msg mw_dhcpv6_dummy := {
              msgType     := ?,
              hopCount    := ?,
              linkAddress := ?,
              peerAddress := ?,
              options     := ?
          } // End of template mw_dhcpv6_dummy
            
            
          /**
           * @desc Genercic receive DHCP Client/Sollicit message
           * @reference http://tools.ietf.org/html/rfc3315#section-6
           */  
          template (present) DHCPv6Msg mdw_dhcpv6_Sollicit_dummy modifies mw_dhcpv6_dummy := {
              msgType     := e_SOLICIT
          } // End of template mdw_dhcpv6_Sollicit_dummy
            
            
        } // End of group dhcpv6DummyRecvTemplates
        
    } // End of group dhcpv6Templates
    
} // End of module AtsDSLite_Templates
+220 −0
Original line number Diff line number Diff line
module AtsDSLite_TestCases {
    
    // LibCommon
    import from LibCommon_DataStrings {
        const c_16ZeroBytes
    };
    import from LibCommon_Sync {
        function 
            f_selfOrClientSyncAndVerdictPreamble, f_selfOrClientSyncAndVerdictTestBody, f_selfOrClientSyncAndVerdict,
            f_serverSyncNClientsAndStop;
        group standardSyncPointNames 
    };
    
    // LibIPv6
    import from LibIpv6_CommonRfcsDhcp_TypesAndValues {
        type 
            DHCPv6Msg; 
        group dhcpConstants
    };
    import from LibIpv6_CommonRfcsDhcp_Functions {
        function f_sendDhcpv6Msg
    };
    
    // DSLitefrom 
    import from AtsDSLite_Functions all;
    import from AtsDSLite_Templates all;
    import from AtsDSLite_Interfaces all; // TODO Remove all
    
    group b4Sut {
        
        group gatewayAssignement {
            
            group validBehaviour {
                
                /**
                 * @desc Check that IUT sends a DHCPv6 Request to the DHCPv6 Server after initialization
                 * @verdict pass on success, inconc on timeout, fail otherwise
                 * <pre>        
                 * PICS Selection: none 
                 * Initial conditions:
                 *  with {
                 *      the IUT is properly provisioned
                 *      the interfaces are connected & functional 
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT goes online
                 *      }
                 *      then {
                 *          the IUT sends a DHCPv6 Request to DHCPv6 Server 
                 *              containing the Option field
                 *                   indicating the AFTR-name DHCPv6 Option (value 64)
                 *      }
                 *  }
                 * </pre>
                 * 
                 * @version 0.0.1
                 * @reference RFC6334 [1] clause 5
                 * @see     ETSI TS xxx xxx-x V0.0.1.5a-draft (2014-01) TP/DSLITE/B4/GWA/BV/001
                 */
                testcase TC_DSLITE_B4_GWA_BV_001() runs on DSLiteComponent system TestAdapter {
        
                    // 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;
                    
                    // Test control
                    
                    // Test component configuration
// TODO                    f_cf01Up_B4(v_dhcpv6Component, v_dnsComponent);
                    f_cf01Up_B4(v_aftrComponent, v_hostComponent, v_dhcpv6Component, v_dnsComponent);
                    
                    // 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
//                    f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
//                    log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
                                        
                    // Test Body
                    // Clause 'when': 
//                    action("the IUT goes online");
                    
                    // Clause 'then': 
//                    while (v_exitLoop == false) {
//                        tc_ac.start;
//                        alt {
//                            [] ipPort.receive( // Receive an UDP/DHCPv6 packet
//                                mw_udpDhcpv6Pkt
//                            ) { 
//                                tc_ac.stop;
//                                // Extract the DHCP message
//                                if (0 != decvalue(oct2bit(mw_udpDhcpv6Pkt.ipv6Payload.udpMsg.data), v_dHCPv6Msg)) {
//                                    // TODO 
//                                } else { // Send it to DHCPv6 component
//                                    dhcpv6Port.send(v_dHCPv6Msg);
//                                }
//                            }
//                            // FIXME Receive DNS/DHCPv6 packet
//                            [] ipv4Port.receive  { // TODO To ne continued
//                                tc_ac.stop;
//                                // TODO Implement processing
//                            }
//                            [] a_ipv6UnsupportedMessages() {
//                            }
//                            [] dhcpv6Port.receive(
//                                mw_dhcpv6_dummy
//                            ) -> value v_dHCPv6Msg {
//                                // Forward message to the IUT
//                                tc_ac.stop;
//                                f_sendDhcpv6Msg(
//                                                v_dHCPv6Msg,
//                                                c_16ZeroBytes,
//                                                c_all_DHCP_Servers,
//                                                c_dhcpv6ClientPort,
//                                                c_dhcpv6ServerPort
//                                );                             
//                            }
//                            [] tc_ac.timeout {
//                                log("*** " & __SCOPE__ & ": INCONC: Expected BTP packet not received ***");
//                                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
//                                v_exitLoop := true;
//                            }   
//                        } // End of 'alt' statement
//                        
//                    } // End of 'while' statement
        
                    // Postamble
                    f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                    f_cf01Down_B4();
                    
                } // End of testcase TC_DSLITE_B4_GWA_BV_001
                
                group f_TC_DSLITE_B4_GWA_BV_001 {
                    
                    function f_TC_DSLITE_B4_GWA_BV_001_dhcpv6() runs on DHCPv6Component {
                        
                        // Local variables
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_dhcpv6();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamblue done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT receives a UL-Request
                        
                        // Clause 'then': the IUT sends a UL-Answer
                        tc_ac.start;
                        alt {
                            [] dhcpv6Port.receive(
                                mdw_dhcpv6_Sollicit_dummy // FIXME To be refined
                            ) { 
                                // Send UDP/ADVERTISE

                            }
                            [] 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_dhcpv6();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_DSLITE_B4_GWA_BV_001_dhcpv6
                    
/* TODO                   function f_TC_DSLITE_B4_GWA_BV_001_dns() runs on DNSComponent {
                        
                        // Local variables
                        
                        // Preamble
                        // Clause 'Initial conditions'
                        f_preamble_dns();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Preamblue done. ***");
                        
                        // Test Body
                        // Clause 'when': the IUT receives a UL-Request
                        
                        // Clause 'then': the IUT sends a UL-Answer
                        tc_ac.start;
                        alt {
                            [] dnsPort.receive { // TODO To ne continued
                            }
                            [] 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_dns();
                        f_selfOrClientSyncAndVerdict(c_poDone, e_success);
                        log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
                        
                    } // End of function f_TC_DSLITE_B4_GWA_BV_001_dns
*/                    
                } // End of group f_TC_DSLITE_B4_GWA_BV_001
                
            } // End of group validBehaviour
        
        } // End of group gatewayAssignement
    
    } // End of group b4Sut
    
} // End of module AtsDSLite_TestCases
Loading