Commit ff13766d authored by Elian Kraja's avatar Elian Kraja
Browse files

Added negative tests on MEC012 and check ProblemDetails on mec010-2

parent 4a5bf742
Loading
Loading
Loading
Loading
+658 −0
Original line number Original line Diff line number Diff line
/*
Copyright (c) ETSI 2018.

This software is subject to copyrights owned by ETSI. Non-exclusive permission
is hereby granted, free of charge, to copy, reproduce and amend this file
under the following conditions: It is provided "as is", without warranty of any
kind, expressed or implied.

ETSI shall never be liable for any claim, damages, or other liability arising
from its use or inability of use.This permission does not apply to any documentation
associated with this file for which ETSI keeps all rights reserved. The present
copyright notice shall be included in all copies of whole or part of this
file and shall not imply any sub-license right.
*/
Package app_pkg_mgt {
   
   import all from MEC_Common;
   import all from MEC_010_2_Domain;
   
   //All APP packages

   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_001"
      
      Test objective 
         "Check that MEO creates a new App Package when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.3.2-1",      //OnboardedAppPkgInfo
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.2.2-1"      //AppPkg
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPOST containing 
               uri indicating value "/apmi/v1/app_packages",
               body containing
                  AppPkg containing
                     appPkgName set to APP_PKG_NAME,
                     appPkgVersion set to APP_PKG_VERSION,
                     appProvider set to APP_PROVIDER,
                     checksum set to CHECKSUM,
                     appPkgPath set to APP_PKG_PATH
                  ;
               ;
            ; from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK,      //TODO: it should return 201 - specification to be updated
               body containing 
                  OnboardedAppPkgInfoList containing
                     OnboardedAppPkgInfo containing
                        appPkgName set to APP_PKG_NAME,
                        appPkgVersion set to APP_PKG_VERSION,
                        appProvider set to APP_PROVIDER,
                        checksum set to CHECKSUM,
                        appPkgPath set to APP_PKG_PATH,
                        operationalState set to "ENABLED",
                        usageState set to "NOT_IN_USE"
                     ;
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }       
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_001_NEG_A"         //Negative case 400 Bad request
      
      Test objective 
         "Check that MEO responds with an error when it receives 
         a malformed request for creating a new App Package"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.2.2-1"      //AppPkg
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPOST containing 
               uri indicating value "/apmi/v1/app_packages",
               body containing
                  AppPkg containing
                     "not" appPkgName                  //mandatory attribute
                  ;
               ;
            ; from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_400_BAD_REQUEST,
               body containing
                  problemDetails containing
                     status set to 400,
                     detail set to any_value
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }       
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_001_NEG_B"         //Negative case 401 Unauthorized - no token
      
      Test objective 
         "Check that MEO responds with an error when it receives 
         a request for creating a new App Package without credentials"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.2.2-1"      //AppPkg
              
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPOST containing 
               uri indicating value "/apmi/v1/app_packages",
               "not" authorization,               //Token is mandatory
               body containing
                  AppPkg containing
                     appPkgName set to any_value
                  ;
               ;
            ; from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_401_UNAUTHORIZED,
               body containing
                  problemDetails containing
                     status set to 401,
                     detail set to any_value
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }       
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_001_NEG_C"         //Negative case 401 Unauthorized - wrong token
      
      Test objective 
         "Check that MEO responds with an error when it receives 
         a request for creating a new App Package with wrong credentials"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.2.2-1"      //AppPkg
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a HttpMsg containing
               headers set to vHeadersInvalidToken,      //wrong token
               uri indicating value "/apmi/v1/app_packages",
               body containing
                  AppPkg containing
                     appPkgName set to any_value
                  ;
               ;
            ; from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_401_UNAUTHORIZED,
               body containing
                  problemDetails containing
                     status set to 401,
                     detail set to any_value
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }       
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_001_NEG_D"         //Negative case 404 Not found
      
      Test objective 
         "Check that MEO responds with an error when it receives 
         a request for creating a new App Package to a wrong URI"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.2.2-1"      //AppPkg
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPOST containing
               uri indicating value "/apmi/v1/appPackages",      //wrong URI
               body containing
                  AppPkg containing
                     appPkgName set to any_value
                  ;
               ;
            ; from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_404_NOT_FOUND,
               body containing
                  problemDetails containing
                     status set to 404,
                     detail set to any_value
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }       
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_002a"
      
      Test objective 
         "Check that MEO returns the list of App Packages when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.1.3.2",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.3.2-1"      //OnboardedAppPkgInfo

      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            appDId indicating value APPD_ID;
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vGET containing 
               uri indicating value "/apmi/v1/app_packages";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK,
               body containing 
                  OnboardedAppPkgInfoList containing
                     OnboardedAppPkgInfo containing 
                        appPkgId set to ON_BOARDED_APP_PKG_ID,
                        appDId set to APPD_ID
                     ;
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }
   }
   
   //Individual APP packages
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_002b"
      
      Test objective 
         "Check that MEO returns the an App Package when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.2",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.3.2-1"      //OnboardedAppPkgInfo
                
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            appDId indicating value APPD_ID;
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vGET containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK,
               body containing 
                  OnboardedAppPkgInfo containing 
                     appPkgId set to ON_BOARDED_APP_PKG_ID,
                     appDId set to APPD_ID
                  ;
               ;
            ; to the MEC_OSS entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_003"
      
      Test objective 
         "Check that MEO deletes an App Package when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.4"
              
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID;
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vDELETE containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK      //TODO: it should return 204 - specification to be updated
            ; to the MEC_OSS entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_004"
      
      Test objective 
         "Check that MEO enables an App Package when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.3"
                
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            operationalState set to "DISABLED";      //Ref. Table 6.2.3.3.2-1 MEC 010-2
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPUT containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}",
               uri_parameter appPkgOperation indicating value "ENABLE";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK;
            to the MEC_OSS entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_004_NEG_A"      //Negative case: 403 FORBIDDEN (operation not allowed due to the current status of the resource)
      
      Test objective
         "Check that MEO responds with an error when it receives 
         a request to enable an App Package that is already enabled"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.3"
                
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            operationalState set to "ENABLED";      //Ref. Table 6.2.3.3.2-1 MEC 010-2
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPUT containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}",
               uri_parameter appPkgOperation indicating value "ENABLE";      //Wrong since the app package is already enabled 
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_403_FORBIDDEN,
               body containing
                  problemDetails containing
                     status set to 403,
                     detail set to any_value
                  ;
               ;
            ;
            to the MEC_OSS entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MM1_PKGM_005"
      
      Test objective 
         "Check that MEO disables an App Package when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.3"
                
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            operationalState set to "ENABLED";      //Ref. Table 6.2.3.3.2-1 MEC 010-2
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPUT containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}",
               uri_parameter appPkgOperation indicating value "DISABLE";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK;
            to the MEC_OSS entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MEC25_MM1_PKGM_001"
      
      Test objective 
         "Check that MEO aborts an App Package deletion operation when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.2.3.3"
                
      Config Id Config_MEC_2
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package containing
            appPkgId indicating value ON_BOARDED_APP_PKG_ID,
            operationalState set to "DELETION_PENDING";      //Ref. Table 6.2.3.3.2-1 MEC 010-2
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPUT containing 
               uri indicating value "/apmi/v1/app_packages/{ON_BOARDED_APP_PKG_ID}",
               uri_parameter appPkgOperation indicating value "ABORT";
               from the MEC_OSS entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK;
            to the MEC_OSS entity
         }
      }
   }

   //All Subscriptions

   Test Purpose {
      TP Id "TP_MEC_MEO_MEC25_MM3_PKGM_001a"
      
      Test objective 
         "Check that MEO creates a new subscription entry when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.3.3.1",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.9.2-1",      //AppPkgSubscription
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.6.2-1"      //AppPkgSubscriptionInfo  
              
      Config Id Config_MEC_3
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT

      Initial conditions  with {
         the IUT entity being_in idle_state
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vPOST containing 
               uri indicating value "/apmi/v1/subscriptions",
               body containing
                  AppPkgSubscription containing
                     subscriptionType set to "ON_BOARDING",
                     callbackUri set to CALLBACK_URI
                  ;
               ;
            ; from the MEC_SUB entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
                status set to HTTP_201_CREATED,
                 body containing 
                    AppPkgSubscriptionInfo containing
                     subscriptionId set to any_value,
                     subscriptionType set to "ON_BOARDING",
                           callbackUri set to CALLBACK_URI
                    ;
               ;
            ; to the MEC_SUB entity
         }
      }       
   }

   Test Purpose {
      TP Id "TP_MEC_MEO_MEC25_MM3_PKGM_001b"
      
      Test objective 
         "Check that MEO returns the list of App Package Management subscriptions when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.3.3.2",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.7.2-1"      //AppPkgSubscriptionLinkList
              
      Config Id Config_MEC_3
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package_subscription containing
            subscriptionId set to SUBSCRIPTION_ID,
            subscriptionType set to "ON_BOARDING";
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vGET containing 
               uri indicating value "/apmi/v1/subscriptions";
               from the MEC_SUB entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK,
               body containing 
                  AppPkgSubscriptionLinkList containing
                     subscriptions containing 
                        href set to "/apmi/v1/subscriptions/{SUBSCRIPTION_ID}",
                        rel set to "ON_BOARDING"
                     ;
                  ;
               ;
            ; to the MEC_SUB entity
         }
      }
   }

   //Individual Subscriptions
   Test Purpose {
      TP Id "TP_MEC_MEO_MEC25_MM3_PKGM_001c"
      
      Test objective 
         "Check that MEO returns the an App Package Management Subscription when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.4.3.2",
              "ETSI GS MEC 010-2 1.2.2, Table 6.2.3.6.2-1"      //AppPkgSubscriptionInfo  
             
                
      Config Id Config_MEC_3
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package_subscription containing
            subscriptionId set to SUBSCRIPTION_ID,
            subscriptionType set to "ON_BOARDING";
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vGET containing 
               uri indicating value "/apmi/v1/subscriptions/{SUBSCRIPTION_ID}";
               from the MEC_SUB entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_200_OK,
               body containing 
                  AppPkgSubscriptionInfo containing 
                     subscriptionId set to SUBSCRIPTION_ID,
                     subscriptionType set to "ON_BOARDING"
                  ;
               ;
            ; to the MEC_SUB entity
         }
      }
   }
   
   Test Purpose {
      TP Id "TP_MEC_MEO_MEC25_MM3_PKGM_001d"
      
      Test objective 
         "Check that MEO deletes an App Package Management Subscription when requested"
      
      Reference "ETSI GS MEC 010-2 1.2.2, clause 7.3.4.3.4"
              
      Config Id Config_MEC_3
      PICS Selection PIC_APP_PACKAGE and PIC_APP_PACKAGE_MANAGEMENT 

      Initial conditions  with {
         the IUT entity having a App_Package_subscription containing
            subscriptionId set to SUBSCRIPTION_ID;
      }

      Expected behaviour
      ensure that {
         when {
            the IUT entity receives a vDELETE containing 
               uri indicating value "/apmi/v1/subscriptions/{SUBSCRIPTION_ID}";
               from the MEC_SUB entity
         }
         then {
            the IUT entity sends a HTTP_RESPONSE containing
               status set to HTTP_204_NO_CONTENT
            ; to the MEC_SUB entity
         }
      }
   }
}
+520 −0

File changed.

Preview size limit exceeded, changes collapsed.

+222 −0

File changed.

Preview size limit exceeded, changes collapsed.

+341 −0

File changed.

Preview size limit exceeded, changes collapsed.

+27 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,33 @@ Package MEC_Common {
      STRING "application/json;charset=utf-8";
      STRING "application/json;charset=utf-8";
      string CONTENT_JSON containing s set to "application/json;charset=utf-8";
      string CONTENT_JSON containing s set to "application/json;charset=utf-8";
      
      
<<<<<<< HEAD
=======
      string HTTP_200_OK containing s set to "200 OK";
      STRING "200 OK";
        
      STRING "201 CREATED";
      string HTTP_201_CREATED containing s set to "201 CREATED";

      STRING "204 NO CONTENT";
      string HTTP_204_NO_CONTENT containing s set to "204 NO CONTENT";

      STRING "400 BAD REQUEST";
      string HTTP_400_BAD_REQUEST containing s set to "400 BAD REQUEST";
      
      STRING "401 UNAUTHORIZED";
      string HTTP_401_UNAUTHORIZED containing s set to "401 UNAUTHORIZED";
      
      STRING "403 FORBIDDEN";
      string HTTP_403_FORBIDDEN containing s set to "403 FORBIDDEN";
      
      STRING "404 NOT FOUND";
      string HTTP_404_NOT_FOUND containing s set to "404 NOT FOUND";
      
      STRING "406 NOT ACCEPTABLE";
      string HTTP_406_NOT_ACCEPTABLE containing s set to "406 NOT ACCEPTABLE";      

>>>>>>> Added negative tests on MEC012 and check ProblemDetails on mec010-2
      STRING VALID_TOKEN;
      STRING VALID_TOKEN;
      
      
      STRING NOT_VALID_TOKEN;
      STRING NOT_VALID_TOKEN;