old_contents: default_app_config = 'nodeconductor.cost_tracking.apps.CostTrackingConfig'
  
  
  class PriceItemTypes(object):
      FLAVOR = 'flavor'
      STORAGE = 'storage'
      LICENSE_APPLICATION = 'license-application'
      LICENSE_OS = 'license-os'
      SUPPORT = 'support'
      NETWORK = 'network'
      USAGE = 'usage'
      USERS = 'users'
  
      CHOICES = (
          (FLAVOR, 'flavor'),
          (STORAGE, 'storage'),
          (LICENSE_APPLICATION, 'license-application'),
          (LICENSE_OS, 'license-os'),
          (SUPPORT, 'support'),
          (NETWORK, 'network'),
          (USAGE, 'usage'),
          (USERS, 'users'),
      )
  
      NUMERICS = (STORAGE, USERS)
  
  
  class OsTypes(object):
      CENTOS6 = 'centos6'
      CENTOS7 = 'centos7'
      UBUNTU = 'ubuntu'
      RHEL6 = 'rhel6'
      RHEL7 = 'rhel7'
      FREEBSD = 'freebsd'
      WINDOWS = 'windows'
      OTHER = 'other'
  
      CHOICES = (
          (CENTOS6, 'Centos 6'),
          (CENTOS7, 'Centos 7'),
          (UBUNTU, 'Ubuntu'),
          (RHEL6, 'RedHat 6'),
          (RHEL7, 'RedHat 7'),
          (FREEBSD, 'FreeBSD'),
          (WINDOWS, 'Windows'),
          (OTHER, 'Other'),
      )
  
      CATEGORIES = {
          'linux': (CENTOS6, CENTOS7, UBUNTU, RHEL6, RHEL7)
      }
  
  
  class ApplicationTypes(object):
      WORDPRESS = 'wordpress'
      POSTGRESQL = 'postgresql'
      ZIMBRA = 'zimbra'
      NONE = 'none'
  
      CHOICES = (
          (WORDPRESS, 'WordPress'),
          (POSTGRESQL, 'PostgreSQL'),
          (ZIMBRA, 'Zimbra'),
          (NONE, 'None'),
      )
  
  
  class SupportTypes(object):
      BASIC = 'basic'
      PREMIUM = 'premium'
  
      CHOICES = (
          (BASIC, 'Basic'),
          (PREMIUM, 'Premium'),
      )
  
  
  class CostConstants(object):
      PriceItem = PriceItemTypes
      Application = ApplicationTypes
      Os = OsTypes
      Support = SupportTypes
  
new_contents: """
  Cost tracking - add-on for NC plugins.
  
  
  Add-on adds next functional to plugin:
  
   - calculate and store price estimate for each resource, service, project, customer.
   - register resource used items (ex: CPU, storage for VMs) prices and show their prices for resource cost calculation.
   - get resource used items for current moment.
  
  
  Add-on connection:
  
      1. Implement CostTrackingBackend interface.
  
          class IaaSCostTrackingBackend(CostTrackingBackend):
              ...
  
      2. Add application to add-on register.
  
          CostTrackingRegister.register(self.label, cost_tracking.IaaSCostTrackingBackend)
  
  """
  
  default_app_config = 'nodeconductor.cost_tracking.apps.CostTrackingConfig'
  
  
  class CostTrackingRegister(object):
      """ Register of all connected NC plugins """
  
      _register = {}
  
      @classmethod
      def register(cls, app_label, backend):
          cls._register[app_label] = backend
  
      @classmethod
      def get_registered_backends(cls):
          return cls._register.values()
  
      @classmethod
      def get_resource_backend(cls, resource):
          return cls._register.get(resource._meta.app_label)
  
  
  class CostTrackingBackend(object):
      """ Cost tracking interface for NC plugin """
  
      @classmethod
      def get_used_items(cls, resource):
          """ Return list of items that are currently used by resource
  
          Return format: [(<item type>, <item name>, <item usage>), ...]
          <item usage> should be 1 for all uncountable items (flavors, installed OS ...)
          """
          raise NotImplementedError()
  
      @classmethod
      def get_service_price_list_items(cls, service):
          """ Return list of price items for concrete service """
          raise NotImplementedError()
  
      @classmethod
      def get_default_price_list_items(cls):
          """ Return list of default price items for application """
          raise NotImplementedError()
  
      @classmethod
      def get_monthly_cost_estimate(cls, resource):
          """ Get resource monthly cost estimate """
          # TODO: implement monthly cost estimate calculation based on items prices and used items.
          raise NotImplementedError()
  
subject: Implement cost tracking add-on base structure