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

Fix RouteRule action_type field #28

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions misc/tests/utils_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,18 @@ TEST(Utils, CInterface)

const std::string json_str1 =
"{\n"
" \"action_type\": \"ROUTING_TYPE_UNSPECIFIED\",\n"
" \"routing_type\": \"ROUTING_TYPE_VNET\",\n"
" \"action_type\": \"ACTION_TYPE_DECAP\",\n"
" \"priority\": 2,\n"
" \"vnet\": \"Vnet2\"\n"
"}\n";

char binary[256] = {0};
size_t binary_size = 0;
EXPECT_NO_THROW(binary_size = JsonStringToPbBinary("DASH_ROUTE_TABLE", json_str1.c_str(), binary, sizeof(binary)));
EXPECT_NO_THROW(binary_size = JsonStringToPbBinary("DASH_ROUTE_RULE_TABLE", json_str1.c_str(), binary, sizeof(binary)));
EXPECT_GT(binary_size, 0);

char json[256] = {0};
EXPECT_NO_THROW(PbBinaryToJsonString("DASH_ROUTE_TABLE", binary, binary_size, json, sizeof(json)));
EXPECT_NO_THROW(PbBinaryToJsonString("DASH_ROUTE_RULE_TABLE", binary, binary_size, json, sizeof(json)));
EXPECT_EQ(string(json), json_str1);

const std::string json_str2 =
Expand Down
7 changes: 3 additions & 4 deletions proto/route_rule.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import "route_type.proto";

message RouteRule {
// reference to routing type, action can be decap or drop
route_type.RoutingType action_type = 1 [deprecated = true]; // renamed as routing_type
route_type.ActionType action_type = 1;
// priority of the rule, lower the value, higher the priority
uint32 priority = 2;
// Optional
Expand All @@ -24,11 +24,10 @@ message RouteRule {
// Optional
// optional region_id which the vni/prefix belongs to as a string for any vendor optimizations
optional string region = 7;
route_type.RoutingType routing_type = 8;
// Optional
// Metering class aggregate bits
optional uint32 metering_class_or = 9;
optional uint32 metering_class_and = 10;
optional uint32 metering_class_or = 8;
optional uint32 metering_class_and = 9;
}

// ENI Inbound route table with VNI and optional SRC PA prefix
Expand Down