Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DASH] Add feature support for DASH Metering Configuration #3365

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
1 change: 1 addition & 0 deletions orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ orchagent_SOURCES = \
dash/dashvnetorch.cpp \
dash/dashaclorch.cpp \
dash/dashaclgroupmgr.cpp \
dash/dashmeterorch.cpp \
dash/dashtagmgr.cpp \
dash/pbutils.cpp \
twamporch.cpp
Expand Down
21 changes: 21 additions & 0 deletions orchagent/bulker.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,18 @@ struct SaiBulkerTraits<sai_neighbor_api_t>
using bulk_set_entry_attribute_fn = sai_bulk_set_neighbor_entry_attribute_fn;
};

template<>
struct SaiBulkerTraits<sai_dash_meter_api_t>
{
using entry_t = sai_object_id_t;
using api_t = sai_dash_meter_api_t;
using create_entry_fn = sai_create_meter_rule_fn;
using remove_entry_fn = sai_remove_meter_rule_fn;
using set_entry_attribute_fn = sai_set_meter_rule_attribute_fn;
using bulk_create_entry_fn = sai_bulk_object_create_fn;
using bulk_remove_entry_fn = sai_bulk_object_remove_fn;
};

template<>
struct SaiBulkerTraits<sai_dash_vnet_api_t>
{
Expand Down Expand Up @@ -1225,3 +1237,12 @@ inline ObjectBulker<sai_dash_vnet_api_t>::ObjectBulker(SaiBulkerTraits<sai_dash_
create_entries = api->create_vnets;
remove_entries = api->remove_vnets;
}

template <>
inline ObjectBulker<sai_dash_meter_api_t>::ObjectBulker(SaiBulkerTraits<sai_dash_meter_api_t>::api_t *api, sai_object_id_t switch_id, size_t max_bulk_size) :
switch_id(switch_id),
max_bulk_size(max_bulk_size)
{
create_entries = api->create_meter_rules;
remove_entries = api->remove_meter_rules;
}
32 changes: 32 additions & 0 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ const map<CrmResourceType, string> crmResTypeNameMap =
{ CrmResourceType::CRM_DASH_IPV6_ACL_GROUP, "DASH_IPV6_ACL_GROUP" },
{ CrmResourceType::CRM_DASH_IPV4_ACL_RULE, "DASH_IPV4_ACL_RULE" },
{ CrmResourceType::CRM_DASH_IPV6_ACL_RULE, "DASH_IPV6_ACL_RULE" },
{ CrmResourceType::CRM_DASH_IPV4_METER_POLICY, "DASH_IPV4_METER_POLICY" },
{ CrmResourceType::CRM_DASH_IPV4_METER_RULE, "DASH_IPV4_METER_RULE" },
{ CrmResourceType::CRM_DASH_IPV6_METER_POLICY, "DASH_IPV6_METER_POLICY" },
{ CrmResourceType::CRM_DASH_IPV6_METER_RULE, "DASH_IPV6_METER_RULE" },
{ CrmResourceType::CRM_TWAMP_ENTRY, "TWAMP_ENTRY" }
};

Expand Down Expand Up @@ -127,6 +131,10 @@ const map<CrmResourceType, sai_object_type_t> crmResSaiObjAttrMap =
{ CrmResourceType::CRM_DASH_IPV6_ACL_GROUP, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_GROUP },
{ CrmResourceType::CRM_DASH_IPV4_ACL_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE },
{ CrmResourceType::CRM_DASH_IPV6_ACL_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_DASH_ACL_RULE },
{ CrmResourceType::CRM_DASH_IPV4_METER_POLICY, (sai_object_type_t)SAI_OBJECT_TYPE_METER_POLICY },
{ CrmResourceType::CRM_DASH_IPV6_METER_POLICY, (sai_object_type_t)SAI_OBJECT_TYPE_METER_POLICY },
{ CrmResourceType::CRM_DASH_IPV4_METER_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_METER_RULE },
{ CrmResourceType::CRM_DASH_IPV6_METER_RULE, (sai_object_type_t)SAI_OBJECT_TYPE_METER_RULE },
{ CrmResourceType::CRM_TWAMP_ENTRY, SAI_OBJECT_TYPE_NULL }
};

Expand Down Expand Up @@ -189,6 +197,10 @@ const map<string, CrmResourceType> crmThreshTypeResMap =
{ "dash_ipv6_acl_group_threshold_type", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_threshold_type", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_threshold_type", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "dash_ipv4_meter_policy_threshold_type", CrmResourceType::CRM_DASH_IPV4_METER_POLICY },
{ "dash_ipv6_meter_policy_threshold_type", CrmResourceType::CRM_DASH_IPV6_METER_POLICY },
{ "dash_ipv4_meter_rule_threshold_type", CrmResourceType::CRM_DASH_IPV4_METER_RULE },
{ "dash_ipv6_meter_rule_threshold_type", CrmResourceType::CRM_DASH_IPV6_METER_RULE },
{ "twamp_entry_threshold_type", CrmResourceType::CRM_TWAMP_ENTRY }
};

Expand Down Expand Up @@ -231,6 +243,10 @@ const map<string, CrmResourceType> crmThreshLowResMap =
{ "dash_ipv6_acl_group_low_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_low_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_low_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "dash_ipv4_meter_policy_low_threshold", CrmResourceType::CRM_DASH_IPV4_METER_POLICY },
{ "dash_ipv6_meter_policy_low_threshold", CrmResourceType::CRM_DASH_IPV6_METER_POLICY },
{ "dash_ipv4_meter_rule_low_threshold", CrmResourceType::CRM_DASH_IPV4_METER_RULE },
{ "dash_ipv6_meter_rule_low_threshold", CrmResourceType::CRM_DASH_IPV6_METER_RULE },
{ "twamp_entry_low_threshold", CrmResourceType::CRM_TWAMP_ENTRY }
};

Expand Down Expand Up @@ -273,6 +289,10 @@ const map<string, CrmResourceType> crmThreshHighResMap =
{ "dash_ipv6_acl_group_high_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "dash_ipv4_acl_rule_high_threshold", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "dash_ipv6_acl_rule_high_threshold", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "dash_ipv4_meter_policy_high_threshold", CrmResourceType::CRM_DASH_IPV4_METER_POLICY },
{ "dash_ipv6_meter_policy_high_threshold", CrmResourceType::CRM_DASH_IPV6_METER_POLICY },
{ "dash_ipv4_meter_rule_high_threshold", CrmResourceType::CRM_DASH_IPV4_METER_RULE },
{ "dash_ipv6_meter_rule_high_threshold", CrmResourceType::CRM_DASH_IPV6_METER_RULE },
{ "twamp_entry_high_threshold", CrmResourceType::CRM_TWAMP_ENTRY }
};

Expand Down Expand Up @@ -322,6 +342,10 @@ const map<string, CrmResourceType> crmAvailCntsTableMap =
{ "crm_stats_dash_ipv6_acl_group_available", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "crm_stats_dash_ipv4_acl_rule_available", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "crm_stats_dash_ipv6_acl_rule_available", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "crm_stats_dash_ipv4_meter_policy_available", CrmResourceType::CRM_DASH_IPV4_METER_POLICY },
{ "crm_stats_dash_ipv6_meter_policy_available", CrmResourceType::CRM_DASH_IPV6_METER_POLICY },
{ "crm_stats_dash_ipv4_meter_rule_available", CrmResourceType::CRM_DASH_IPV4_METER_RULE },
{ "crm_stats_dash_ipv6_meter_rule_available", CrmResourceType::CRM_DASH_IPV6_METER_RULE },
{ "crm_stats_twamp_entry_available", CrmResourceType::CRM_TWAMP_ENTRY }
};

Expand Down Expand Up @@ -364,6 +388,10 @@ const map<string, CrmResourceType> crmUsedCntsTableMap =
{ "crm_stats_dash_ipv6_acl_group_used", CrmResourceType::CRM_DASH_IPV6_ACL_GROUP },
{ "crm_stats_dash_ipv4_acl_rule_used", CrmResourceType::CRM_DASH_IPV4_ACL_RULE },
{ "crm_stats_dash_ipv6_acl_rule_used", CrmResourceType::CRM_DASH_IPV6_ACL_RULE },
{ "crm_stats_dash_ipv4_meter_policy_used", CrmResourceType::CRM_DASH_IPV4_METER_POLICY },
{ "crm_stats_dash_ipv6_meter_policy_used", CrmResourceType::CRM_DASH_IPV6_METER_POLICY },
{ "crm_stats_dash_ipv4_meter_rule_used", CrmResourceType::CRM_DASH_IPV4_METER_RULE },
{ "crm_stats_dash_ipv6_meter_rule_used", CrmResourceType::CRM_DASH_IPV6_METER_RULE },
{ "crm_stats_twamp_entry_used", CrmResourceType::CRM_TWAMP_ENTRY },
};

Expand Down Expand Up @@ -891,6 +919,10 @@ void CrmOrch::getResAvailableCounters()
case CrmResourceType::CRM_DASH_IPV6_INBOUND_ROUTING:
case CrmResourceType::CRM_DASH_IPV4_OUTBOUND_ROUTING:
case CrmResourceType::CRM_DASH_IPV6_OUTBOUND_ROUTING:
case CrmResourceType::CRM_DASH_IPV4_METER_POLICY:
case CrmResourceType::CRM_DASH_IPV6_METER_POLICY:
case CrmResourceType::CRM_DASH_IPV4_METER_RULE:
case CrmResourceType::CRM_DASH_IPV6_METER_RULE:
case CrmResourceType::CRM_DASH_IPV4_PA_VALIDATION:
case CrmResourceType::CRM_DASH_IPV6_PA_VALIDATION:
case CrmResourceType::CRM_DASH_IPV4_OUTBOUND_CA_TO_PA:
Expand Down
4 changes: 4 additions & 0 deletions orchagent/crmorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ enum class CrmResourceType
CRM_DASH_IPV6_ACL_GROUP,
CRM_DASH_IPV4_ACL_RULE,
CRM_DASH_IPV6_ACL_RULE,
CRM_DASH_IPV4_METER_POLICY,
CRM_DASH_IPV6_METER_POLICY,
CRM_DASH_IPV4_METER_RULE,
CRM_DASH_IPV6_METER_RULE,
CRM_TWAMP_ENTRY
};

Expand Down
Loading
Loading