Commit fd35838d authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

change payload to have relate party, created party feature, add get order and...

change payload to have relate party, created party feature, add get order and services, terminate services, delete services and orders.... Related to: #10
parent aa31d746
Loading
Loading
Loading
Loading
−2
Changes for src/test/resources/hypo/auth.feature: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,4 @@ Scenario: Get Hypo access token
  And match response.expires_in == '#number'

  * def accessToken = response.access_token
  * print 'Token first 20 chars:', accessToken.substring(0,20)
  * print 'Token length:', accessToken.length
  * print infra
+125 −25
Changes for src/test/resources/hypo/cleanUp.feature: 125 added lines, 25 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,9 @@ Feature: Full clean up of test resources
# Standalone, reusable clean up

Background:
  * def token = auth_token
  * def auth       = call read('classpath:hypo/auth.feature')
  * def token      = auth.accessToken
  * def auth_token = auth.accessToken
  * def deleteEach =
    """
    function(list, callTag, idParam) {
@@ -24,77 +26,175 @@ Background:
    }
    """

@cleanUp
Scenario: Delete services, orders, network, organization, peering, candidates, specifications and registry secrets
  * def cleanupOrgId = orgId ? orgId : '2bc5e74c-4760-425b-911f-eca7df5ce3f0'
  * karate.log('Cleanup triggered for orgId: ' + cleanupOrgId)
@clean-up-workflow
Scenario: Wokflow that terminates services and deletes services, orders, network, organization, peering, candidates, specifications and registry secrets
  * def orgs = call read('classpath:hypo/organization.feature@getOrganizations') { auth_token: '#(auth_token)' }
  * def controllers = call read('classpath:hypo/fabric.feature@getControllers') { auth_token: '#(auth_token)' }
  * def peering = call read('classpath:hypo/peering.feature@getPeerings') { auth_token: '#(auth_token)' }
  * def registries = call read('classpath:hypo/registry.feature@getRegistries') { auth_token: '#(auth_token)' }

  * if (cleanUpTerminatedPayloadEndUser && serviceIdEndUser && !terminateEndUserExecuted) karate.call('classpath:hypo/service.feature@terminateServiceCleanUp', { auth_token: token, serviceId: serviceIdEndUser })
  * if (cleanUpTerminatedPayloadEndUser && serviceIdEndUser && !terminateEndUserExecuted) java.lang.Thread.sleep(30000)
  * def allServices = call read('classpath:hypo/service.feature@getAllServices') { auth_token: '#(auth_token)' }
  * def allCfsandOslServices = call read('classpath:hypo/service.feature@getAllCfsandOslServices') { auth_token: '#(auth_token)' }

  * if (cleanUpTerminatedPayloadResource && serviceIdk8sResource && !terminateServiceExecuted) karate.call('classpath:hypo/service.feature@terminateServiceCleanUp', { auth_token: token, serviceId: serviceIdk8sResource })
  * if (cleanUpTerminatedPayloadResource && serviceIdk8sResource && !terminateServiceExecuted) java.lang.Thread.sleep(30000)
  * def allOrders = call read('classpath:hypo/service.feature@getAllServiceOrders') { auth_token: '#(auth_token)' }

  * if (sOrderEndUserId) karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrderAfter', { auth_token: token, orderId: sOrderEndUserId })
  * if (sOrderK8sId) karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrderAfter', { auth_token: token, orderId: sOrderK8sId })
  * if (networkControllerId) karate.call('classpath:hypo/deleteAll.feature@deleteFabricNetwork', { token: token, networkControllerId: networkControllerId })
  * call read('classpath:hypo/cleanUp.feature@cleanupTerminate') { auth_token: '#(auth_token)', cfsActiveServiceIds: '#(allCfsandOslServices.cfsActiveServiceIds)', oslActiveServiceIds: '#(allCfsandOslServices.oslActiveServiceIds)' }

  * karate.call('classpath:hypo/deleteAll.feature@deletePeeringAfter', { auth_token: token, orgId: cleanupOrgId })
  * java.lang.Thread.sleep(15000)
  * karate.call('classpath:hypo/deleteAll.feature@deleteOrganizationAfter', { auth_token: token, orgId: cleanupOrgId })
  * java.lang.Thread.sleep(15000)
  * eval java.lang.Thread.sleep(1000)

  # Candidates & specifications: no static ids - GET the current list, then delete every id found
  * def candidateResult = karate.call('classpath:hypo/specifications.feature@getServiceCandidate', { auth_token: token })
  * eval deleteEach(candidateResult.response, 'classpath:hypo/deleteAll.feature@deleteCandidate', 'candidateId')

  * def specificationResult = karate.call('classpath:hypo/specifications.feature@getServiceSpecification', { auth_token: token })
  * eval deleteEach(specificationResult.response, 'classpath:hypo/deleteAll.feature@deleteSpecification', 'specificationId')
  * def serviceIdsToDelete = 
    """
    allServices.terminatedServiceIds
    .concat(allServices.feasibilityCheckedServiceIds)
    .concat(allServices.activeServiceIds)
    """
  * def orderIdsToDelete = allOrders.acknowledgedOrderIds.concat(allOrders.completedOrderIds)

  * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryPackage', { auth_token: token })
  * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryImage', { auth_token: token })
  * call read('classpath:hypo/cleanUp.feature@cleanupAll'){ auth_token: '#(auth_token)', organizationIds: '#(orgs.organizationIds)',  peeringIds: '#(peering.peeringIds)', networkControllerIds: '#(controllers.networkControllerIds)', registryImageIds: '#(registries.registryImageIds)', registryPackageIds: '#(registries.registryPackageIds)', serviceIdsToDelete: '#(serviceIdsToDelete)',  orderIdsToDelete: '#(orderIdsToDelete)' }


@cleanupAll
Scenario: Delete all fetched organizations, controllers, peerings, and registries
Scenario: Delete all fetched organizations, controllers, peerings, registries, services and orders
* karate.log('--- STEP: CLEAN UP ALL ---')

* karate.log('--- CLEAN UP STEP 1: CLEAN UP FABRIC ---')
* def deleteControllerFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteFabricNetwork', { token: token, networkControllerId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(networkControllerIds, deleteControllerFn)
  

  * karate.log('--- CLEAN UP STEP 2: CLEAN UP PEERING ---')
  * def deletePeeringFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deletePeeringbyId', { token: token, orgId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(peeringIds, deletePeeringFn)

  * karate.log('--- CLEAN UP STEP 3: CLEAN UP ORGANIZATIONS ---')
    * def deleteOrgFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteOrganizationbyId', { token: token, orgId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(organizationIds, deleteOrgFn)

  * karate.log('--- CLEAN UP STEP 4: CLEAN UP REGISTRY IMAGES---')
  * def deleteRegistryImageFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteRegistryImagebyId', { token: token, registryImageId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(registryImageIds, deleteRegistryImageFn)

  * karate.log('--- CLEAN UP STEP 5: CLEAN UP REGISTRY PACKAGES---')

  * def deleteRegistryPackageFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteRegistryPackagebyId', { token: token, registryPackageId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(registryPackageIds, deleteRegistryPackageFn)

  * karate.log('--- CLEAN UP STEP 6: CLEAN UP SERVICES ---')

  * def serviceIdsToDelete = karate.get('serviceIdsToDelete', [])

  * def deleteServiceFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteServicebyId', { token: token, serviceId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(serviceIdsToDelete, deleteServiceFn)

  * karate.log('--- CLEAN UP STEP 7: CLEAN UP ORDEDS ---')

  * def deleteOrderFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrder', { token: token, orderId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * karate.forEach(orderIdsToDelete, deleteOrderFn)


@cleanupTerminate
Scenario: Terminate active CFS and OSL services before cleanup

  * def cfsActiveServiceIds = karate.get('cfsActiveServiceIds', [])
  * def oslActiveServiceIds = karate.get('oslActiveServiceIds', [])

  * def terminateServiceFn =
  """
  function(id) {
    karate.log('Terminating active service:', id);
    karate.call('classpath:hypo/service.feature@terminateServiceCleanUp', { auth_token: token, serviceId: id });
    java.lang.Thread.sleep(1000);

  }
  """
  * print 'CFS :', cfsActiveServiceIds
  * print 'OSL:', oslActiveServiceIds


  * karate.log('--- STEP TERMINATE: TERMINATE ACTIVE CFS SERVICES ---')
  * karate.forEach(cfsActiveServiceIds, terminateServiceFn)

  * karate.log('--- STEP TERMINATE: TERMINATE ACTIVE OSL SERVICES ---')
  * karate.forEach(oslActiveServiceIds, terminateServiceFn)



# @cleanUp
# Scenario: Delete services, orders, network, organization, peering, candidates, specifications and registry secrets
#   * def cleanupOrgId = orgId ? orgId : '2bc5e74c-4760-425b-911f-eca7df5ce3f0'
#   * karate.log('Cleanup triggered for orgId: ' + cleanupOrgId)

#   * if (cleanUpTerminatedPayloadEndUser && serviceIdEndUser && !terminateEndUserExecuted) karate.call('classpath:hypo/service.feature@terminateServiceCleanUp', { auth_token: token, serviceId: serviceIdEndUser })
#   * if (cleanUpTerminatedPayloadEndUser && serviceIdEndUser && !terminateEndUserExecuted) java.lang.Thread.sleep(30000)

#   * if (cleanUpTerminatedPayloadResource && serviceIdk8sResource && !terminateServiceExecuted) karate.call('classpath:hypo/service.feature@terminateServiceCleanUp', { auth_token: token, serviceId: serviceIdk8sResource })
#   * if (cleanUpTerminatedPayloadResource && serviceIdk8sResource && !terminateServiceExecuted) java.lang.Thread.sleep(30000)

#   * if (sOrderEndUserId) karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrderAfter', { auth_token: token, orderId: sOrderEndUserId })
#   * if (sOrderK8sId) karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrderAfter', { auth_token: token, orderId: sOrderK8sId })
#   * if (networkControllerId) karate.call('classpath:hypo/deleteAll.feature@deleteFabricNetwork', { token: token, networkControllerId: networkControllerId })

#   * karate.call('classpath:hypo/deleteAll.feature@deletePeeringAfter', { auth_token: token, orgId: cleanupOrgId })
#   * java.lang.Thread.sleep(15000)
#   * karate.call('classpath:hypo/deleteAll.feature@deleteOrganizationAfter', { auth_token: token, orgId: cleanupOrgId })
#   * java.lang.Thread.sleep(15000)

#   # Candidates & specifications: no static ids - GET the current list, then delete every id found
#   * def candidateResult = karate.call('classpath:hypo/specifications.feature@getServiceCandidate', { auth_token: token })
#   * eval deleteEach(candidateResult.response, 'classpath:hypo/deleteAll.feature@deleteCandidate', 'candidateId')

#   * def specificationResult = karate.call('classpath:hypo/specifications.feature@getServiceSpecification', { auth_token: token })
#   * eval deleteEach(specificationResult.response, 'classpath:hypo/deleteAll.feature@deleteSpecification', 'specificationId')

#   * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryPackage', { auth_token: token })
#   * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryImage', { auth_token: token })
 
 No newline at end of file
+9
Changes for src/test/resources/hypo/deleteAll.feature: 9 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -141,3 +141,12 @@ Scenario: Delete Registry Package
  And header Authorization = 'Bearer ' + token
  When method delete
  Then match [200, 204, 404] contains responseStatus


@deleteServicebyId
Scenario: Delete Service by Id
  Given url baseUrl
  And path 'tmf-api', 'serviceInventory', V4, 'service', serviceId
  And header Authorization = 'Bearer ' + token
  When method delete
  Then match [200, 204] contains responseStatus
 No newline at end of file
+6 −2
Changes for src/test/resources/hypo/orchestratorOCM.feature: 6 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -14,12 +14,16 @@ Scenario: Run full sequence once
  * def auth       = call read('classpath:hypo/auth.feature')
  * def auth_token = auth.accessToken
  * def token      = auth.accessToken
  * def individuals = call read('classpath:hypo/party.feature@getIndividuals') { auth_token: '#(auth_token)' }
  * def firstIndividualId = individuals.firstIndividualId


  # Steps 2–6: registry, org, peering, specs (shared) 
  * def setupResults = call read('classpath:hypo/orchestrator-setup.feature') { auth_token: '#(auth_token)' }
  * def orgId = setupResults.orgId
  * def peered_org = setupResults.orgId


   # 7) Create Fabric controller

  * def fabricRes = call read('classpath:hypo/fabric.feature@createFabric') { auth_token: '#(auth_token)' }
@@ -38,7 +42,7 @@ Scenario: Run full sequence once

  # 9) servive order k8s-OCM
  # Create request
  * def createRes = call read('service.feature@createServiceOrderResourceK8s') { auth_token: '#(auth_token)', clusterType:'public-ocm' }
  * def createRes = call read('service.feature@createServiceOrderResourceK8s') { auth_token: '#(auth_token)', individualId: '#(firstIndividualId)', clusterType:'public-ocm' }
  * def newId = createRes.serviceOrderIdK8s
  * print 'serviceOrderIdK8s:', newId
  * def serviceorderk8sid = newId
@@ -58,7 +62,7 @@ Scenario: Run full sequence once

   # 11) servive order end-user-OCM
  # Create request
  * def createRes = call read('service.feature@createServiceOrderPre') { auth_token: '#(auth_token)', serviceK8sId: '#(serviceK8sId)', clusterType:'ocm-prek8s' }
  * def createRes = call read('service.feature@createServiceOrderPre') { auth_token: '#(auth_token)', individualId: '#(firstIndividualId)', serviceK8sId: '#(serviceK8sId)', clusterType:'ocm-prek8s' }
  * def newIdEndUser = createRes.serviceOrderEndUserId
  * print 'serviceOrderId:', newIdEndUser
  * def serviceorderenduserid = newIdEndUser
+4 −17
Changes for src/test/resources/hypo/orchestratorPrivate.feature: 4 added lines, 17 removed lines.
Original line number Diff line number Diff line
@@ -14,14 +14,8 @@ Scenario: Run full sequence once
  * def auth       = call read('classpath:hypo/auth.feature')
  * def auth_token = auth.accessToken
  * def token      = auth.accessToken

  * def orgs = call read('classpath:hypo/organization.feature@getOrganizations') { auth_token: '#(auth_token)' }
  * def controllers = call read('classpath:hypo/fabric.feature@getControllers') { auth_token: '#(auth_token)' }
  * def peering = call read('classpath:hypo/peering.feature@getPeerings') { auth_token: '#(auth_token)' }
  * def registries = call read('classpath:hypo/registry.feature@getRegistries') { auth_token: '#(auth_token)' }

  
  * call read('classpath:hypo/cleanUp.feature@cleanupAll'){ auth_token: '#(auth_token)', organizationIds: '#(orgs.organizationIds)', peeringIds: '#(peering.peeringIds)' , networkControllerIds: '#(controllers.networkControllerIds)', registryImageIds: '#(registries.registryImageIds)' ,registryPackageIds: '#(registries.registryPackageIds)'   }
  * def individuals = call read('classpath:hypo/party.feature@getIndividuals') { auth_token: '#(auth_token)' }
  * def firstIndividualId = individuals.firstIndividualId

  # Steps 2–6: auth, registry, org, peering, specs (shared) 
  * def setupResults = call read('classpath:hypo/orchestrator-setup.feature') { auth_token: '#(auth_token)' }
@@ -46,16 +40,9 @@ Scenario: Run full sequence once



  * def orgs = call read('classpath:hypo/organization.feature@getOrganizations') { auth_token: '#(auth_token)' }
  * def controllers = call read('classpath:hypo/fabric.feature@getControllers') { auth_token: '#(auth_token)' }
  * def peering = call read('classpath:hypo/peering.feature@getPeerings') { auth_token: '#(auth_token)' }
  * def registries = call read('classpath:hypo/registry.feature@getRegistries') { auth_token: '#(auth_token)' }



  # 9) servive order k8s
  # Create request
  * def createRes = call read('service.feature@createServiceOrderResourceK8s') { auth_token: '#(auth_token)', clusterType:'private-prek8s' }
  * def createRes = call read('service.feature@createServiceOrderResourceK8s') { auth_token: '#(auth_token)', individualId: '#(firstIndividualId)', clusterType:'private-prek8s' }
  * def newId = createRes.serviceOrderIdK8s
  * print 'serviceOrderIdK8s:', newId
  * def serviceorderk8sid = newId
@@ -74,7 +61,7 @@ Scenario: Run full sequence once
  * match invResSer.response.state == 'ACTIVE'
  # 11) servive order end-user
  # Create request
  * def createRes = call read('service.feature@createServiceOrderPre') { auth_token: '#(auth_token)', serviceK8sId: '#(serviceK8sId)', clusterType:'private-prek8s' }
  * def createRes = call read('service.feature@createServiceOrderPre') { auth_token: '#(auth_token)', individualId: '#(firstIndividualId)', serviceK8sId: '#(serviceK8sId)', clusterType:'private-prek8s' }
  * def newIdEndUser = createRes.serviceOrderEndUserId
  * print 'serviceOrderId:', newIdEndUser
  * def serviceorderenduserid = newIdEndUser
Loading