Uploaded image for project: 'Subscription Watch'
  1. Subscription Watch
  2. SWATCH-2939

Document tally and capacity calculation report functionality

XMLWordPrintable

    • 5
    • False
    • Hide

      None

      Show
      None
    • False

      Document tally and capacity report since there are gaps in understanding on how it works. This should include how UI queries backend for ROSA and Ansible for reference purposes.

      Also it can be useful to document some of the IQE steps like below

      import logging
      import math
      import random
      import datetime
      import fauxfactory
      import pytest
      from datetime import timedelta
      from dateutil.relativedelta import relativedeltafrom iqe_rhsm_subscriptions.rhsmlib import config_parser
      from iqe_rhsm_subscriptions.internal_apis.swatch_tally import _create_eventsfrom iqe_rhsm_subscriptions.utils.utils import get_swatch_billing_provider_and_payg_product
      from iqe_rhsm_subscriptions.utils.utils import get_swatch_contract_enabled_products
      from iqe_rhsm_subscriptions.utils.utils import get_swatch_non_contract_payg_products
      from iqe_rhsm_subscriptions.utils.utils import today, get_monthly_range
      
      product_id = "ansible-aap-managed"
      billing_provider = "aws"
      application = appapplication.rhsm_subscriptions.reset_account()
      billing_account_id = "test" + fauxfactory.gen_alpha(3).lower()
      metric = "Managed-nodes"
      contract_data = {
                  "billing_provider": billing_provider,
                  "billing_account_id": billing_account_id,
      }
      
      application.rhsm_subscriptions.create_contract(
          product_id=product_id,
          **contract_data,
      )  
      data = {
          metric.lower(): random.randint(1, 20),
          "billing_provider": billing_provider,
          "billing_account_id": billing_account_id,
          "hours": random.randint(1, 20),
          "event_source": "cost-management",
      }
      application.rhsm_subscriptions.create_mock_payg_cluster(product_id=product_id, **data)
      
      application.rhsm_subscriptions.sync_tally_hourly(
          product_id=product_id,
          metric_id=metric,
          perform_metering=False,
          wait=True,
          wait_for_remittance=True,
      )

       

      More info in Slack thread:
      https://redhat-internal.slack.com/archives/C03639R6BAA/p1726668906414379?thread_ts=1726579060.271639&cid=C03639R6BAA

              karshah@redhat.com Kartik Shah
              karshah@redhat.com Kartik Shah
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: