AtsMec_FixedAccessInfoAPI_TestCases.ttcn 69.2 KB
Newer Older
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get( 
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                             mw_onu_alarm_subscription
                                                                                                                                             ))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a OnuAlarmSubscription ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_007_OK
    
    /**
     * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_007_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_get( 
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
                                                      v_headers
                                                      )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found
                                             )) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
        
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_007_NF

    /**
     * @desc Check that the IUT updates an existing subscription when commanded by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_008_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      // TODO If-Match header needs to have a PROPER_ETAG
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                 m_onu_alarm_subscription(
                                                                                                                                                          PX_ONU_ALARM_SUB_CALLBACK_URI,
                                                                                                                                                          m_filter_criteria_onu_alarm
                                                                                                                                                          )
                                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_ok(
                                                                 mw_http_message_body_json(
                                                                                           mw_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                             mw_onu_alarm_subscription
                                                                                                                                             ))))) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a userTrackingSubscription ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_008_OK
    
    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_008_BR() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      // TODO If-Match header needs to have a PROPER_ETAG
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                 m_onu_alarm_subscription_bad_request(
                                                                                                                                                                      PX_ONU_ALARM_SUB_CALLBACK_URI,
                                                                                                                                                                      m_filter_criteria_onu_alarm
                                                                                                                                                                      )
                                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_400_bad_request
                                             )) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with 400 Bad Request ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_008_BR
    
    /**
     * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_008_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      // TODO If-Match header needs to have a PROPER_ETAG
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                 m_onu_alarm_subscription(
                                                                                                                                                          PX_ONU_ALARM_SUB_CALLBACK_URI,
                                                                                                                                                          m_filter_criteria_onu_alarm
                                                                                                                                                          )
                                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found
                                             )) {
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a HTTP error 404 ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_008_NF

    /**
     * @desc Check that the IUT responds with an error when a request sent by a MEC Application doesn't comply with a required condition
     */
    testcase TP_MEC_SRV_FAIS_008_PF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      // TODO If-Match header needs to have an INVALID_ETAG
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_put(
                                                      "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                 m_onu_alarm_subscription(
                                                                                                                                                          PX_ONU_ALARM_SUB_CALLBACK_URI,
                                                                                                                                                          m_filter_criteria_onu_alarm
                                                                                                                                                          )
                                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_412_precondition_failed
                                             )) {
          tc_ac.stop;

          log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 412 Precondition Failed ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_008_PF

    /**
     * @desc Check that the IUT acknowledges the cancellation of UE location change notifications when commanded by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_009_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_delete(
                                                         "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")),
                                                         v_headers
                                                         )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_204_no_content
                                             )) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with no content ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_009_OK
    
    /**
     * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_009_NF() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_delete(
                                                         "/" & PICS_ROOT_API & PX_FAI_SUB_URI & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")),
                                                          v_headers
                                                         )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_404_not_found
                                             )) {
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with no 404 Not Found ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_009_NF
    
    /**
     * @desc Check that the IUT sends notification on expiry of Fixed Access Information event subscription to a MEC Application
     */
    testcase TP_MEC_SRV_FAIS_010_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
      httpPort.send(
                    m_http_request(
                                   m_http_request_post(
                                                       "/" & PICS_ROOT_API & PX_FAI_SUB_URI,
                                                       v_headers,
                                                       m_http_message_body_json(
                                                                                m_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                 m_onu_alarm_subscription(
                                                                                                                                                          PX_ONU_ALARM_SUB_CALLBACK_URI,
                                                                                                                                                          m_filter_criteria_onu_alarm,
                                                                                                                                                          -,
                                                                                                                                                          m_time_stamp(1577836800)
                                                                                                                                                          )
                                                                                                                                 )
                                                                                )
                                                       )
                                   )
                    );
      f_selfOrClientSyncAndVerdict(c_prDone, e_success);
      
      // Test Body
      tc_ac.start;
      alt {
        [] httpPort.receive(
                            mw_http_response(
                                             mw_http_response_201_created(
                                                                 mw_http_message_body_json(
                                                                                mw_body_json_fai_onu_alarm_subscription_link_list(
                                                                                                                                  mw_onu_alarm_subscription
                                                                                                                                  ))))) {
          // TODO Need to check Location header

          // TODO: how to wait for a timeout of (NOW_PLUS_X_SECONDS - guard time)? which guard time value to use?
               // MEC 029, clause 5.2.6.2
//               the IUT entity sends a vPOST containing
//                  uri indicating value CALLBACK_URL
//                  body containing
//                     ExpiryNotification containing
//                        expiryDeadline indicating value NOW_PLUS_X_SECONDS    // TODO: how to set this?
//                     ;
//                  ;
//               ;
//               to the MEC_APP entity
          tc_ac.stop;
          
          log("*** " & testcasename() & ": PASS: IUT successfully responds with a DevInfoSubscription ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
        }
        [] tc_ac.timeout {
          log("*** " & testcasename() & ": INCONC: Expected message not received ***");
          f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
        }
      } // End of 'alt' statement
      
      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_010_OK
    
    /**
     * @desc Check that the IUT acknowledges the subscription by a MEC Application to notifications on Optical Network Unit alarm events
     */
    testcase TP_MEC_SRV_FAIS_011_OK() runs on HttpComponent system HttpTestAdapter {
      // Local variables
      var HeaderLines v_headers;
      
      // Test control
      if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_FAI_API_SUPPORTED)) {
        log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_FAI_API_SUPPORTED required for executing the TC ***");
        setverdict(inconc);
        stop;
      }
      
      // Test component configuration
      f_cf_01_http_up();
      
      // Test adapter configuration
      
      // Preamble
      f_init_default_headers_list(-, -, v_headers);
        
// TODO how to generate an event?
//      Initial conditions  with {
//         the IUT entity being_in idle_state and
//         the IUT entity having a subscriptions containing,
//            subscriptionType indicating value "OnuAlarmSubscription"
//            callbackReference indicating value CALLBACK_URL
//         ;
//      }
//
//      // MEC 029, clause 5.2.7
//      Expected behaviour
//         ensure that {
//            when {
//               the IUT entity generates a onu_alarm_event
//            }
//            then {
//               // // MEC 029, clause 5.2.7
//               the IUT entity sends a vPOST containing
//                  Uri set to CALLBACK_URL
//                  body containing
//                     OnuAlarmSubscription containing
//                        notificationType set to "OnuAlarmSubscription"
//                     ;
//                  ;
//               ;
//               to the MEC_APP entity
//            }
//         }

      // Postamble
      f_cf_01_http_down();
    } // End of testcase TP_MEC_SRV_FAIS_011_OK
    
  } // End of group fixedAccessInfoService
  
} // End of module AtsMec_FixedAccessInfoAPI_TestCases