-
Notifications
You must be signed in to change notification settings - Fork 29
PR for Security group for early feedback #156
base: master
Are you sure you want to change the base?
Conversation
// | ||
// Created by Administrator on 2020/10/12. | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the first three lines of extra header.
|
||
class Aca_Security_Group_Rule { | ||
public: | ||
static Aca_Security_Group_Rule &get_instance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACA uses .clang-format to do automatic formatting. I have the setting in my IDE to auto-format on file save. Please see if you can do similar settings in your IDE.
@@ -322,7 +322,7 @@ void ACA_OVS_L2_Programmer::execute_ovsdb_command(const std::string cmd_string, | |||
|
|||
auto ovsdb_client_start = chrono::steady_clock::now(); | |||
|
|||
string ovsdb_cmd_string = "/usr/bin/ovs-vsctl " + cmd_string; | |||
string ovsdb_cmd_string = "ovs-vsctl " + cmd_string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already removed "/usr/bin/" in the latest master.
Aca_Security_Group::Aca_Security_Group(Aca_Security_Group &sg) { | ||
this->id = sg.get_id(); | ||
this->name = sg.get_name(); | ||
this->format_version = sg.get_format_version(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format_version will be removed from the schema soon because it is not effective to help with grpc message compatibility (we are keeping the one in the top level GoalState message.
aca_sg = siter->second; | ||
} | ||
|
||
aca_sg->add_port_id(port_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note that we also keep track of ports inside vlan manager for other usage. see ACA_Vlan_Manager::get_instance().add_ovs_port. I think it is okay for security group manager to track ports seperately for now but can consider merging in the future.
string port_id = input_port.get_id(); | ||
string sg_id = input_sg.get_id(); | ||
|
||
//TODO: do we need to update the port ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we need to update port when security group is updated.
|
||
aca_sg_rule = sg.get_security_group_rule(rule_id); | ||
if (aca_sg_rule != NULL) { | ||
TRN_LOG_WARN("Security group rule(id:%s) already exist", rule_id.data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ACA_LOG_WARN instead of TRN_LOG_WARN
int Aca_Security_Group_Manager::set_remote_group(Aca_Security_Group_Rule &sg_rule) | ||
{ | ||
map<string, Aca_Security_Group *>::iterator iter; | ||
string remote_grou_id = sg_rule.get_remote_group_id(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: remote_grou_id :)
// Drop all remaining egress connections | ||
sprintf(flow, "table=%d,priority=10,in_port=%d,reg%d=%d,actions=ct_clear,resubmit(,%d)", | ||
BASE_EGRESS_TABLE, ofport, REG_PORT, ofport, DROPPED_TRAFFIC_TABLE); | ||
controller.add_flow(BR_INT, flow); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_flow can fail and returns and error code.
Do you want to add the flows as bundle so that it is "all or nothing"
@cj-chung - FYI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start. I have left some early feedback.
…#156) This PR adds quite a few design docs including * Key System Flows * Alcor Controller Microservices - Mac Manager * Alcor Database and Cache services * Alcor Control Agent - major components design * Communication - Fast path, normal path and rescue path * System Monitoring * Communication Protocol with Compute
closing this old draft PR. |
Here is my additional comments on this draft security group implementation:
|
This is the PR for Security group implementation so that we can provide some early feedback.