GitHub user nickaccuweb added a comment to the discussion: Cloudstack 4.22 and 
Tarrif Plugin - How to give 1 IP Address and VR for free and tarrif the others?

@EduFrazao 

Yes, this is partially possible using CloudStack's Quota Plugin and tariff 
activation rules.

1. First Source NAT IP free, additional IPs chargeable

For the IP_ADDRESS tariff (usage type 3), you can use the following activation 
rule to exclude Source NAT addresses from billing:

resourceType !== 'SourceNat'

This allows you to charge additional public IP addresses while excluding Source 
NAT IPs.

2. Different tariffs for your three Network Offerings

You can use the NETWORK_OFFERING tariff (usage type 13) and apply different 
pricing based on the offering's name or tag.

For example, you could create separate pricing rules for your 100 Mbps, 500 
Mbps and 1 Gbps offerings.

However, CloudStack 4.22 tracks Network Offering usage at the instance/network 
attachment level, so these tariffs should not be treated as direct Virtual 
Router charges.

3. First Virtual Router free, additional Virtual Routers chargeable

This part requires some additional logic. CloudStack does not provide a 
separate per-Virtual-Router tariff that automatically identifies the first 
router belonging to an account.

If your intention is to include the first isolated network and its Virtual 
Router for free, then charge for additional isolated networks, I would 
recommend using CloudStack's usage records together with an external billing 
system.

The billing system can identify the account's networks, exclude the first 
eligible network, and apply the appropriate price to each additional network 
based on its Network Offering.

Also, if you are using redundant Virtual Routers for HA, remember that two 
routers can belong to the same network, so they should not automatically be 
treated as two separately billable networks.

You can check the available tariff variables using the quotaPresetVariablesList 
API and validate your activation rules using quotaValidateActivationRule before 
applying them.

Hope this helps!

Regards,
Nick R 
AccuWeb.Cloud

GitHub link: 
https://github.com/apache/cloudstack/discussions/14323#discussioncomment-19450737

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to