Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

PR for Security group for early feedback #156

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

er1cthe0ne
Copy link
Contributor

This is the PR for Security group implementation so that we can provide some early feedback.

@er1cthe0ne er1cthe0ne marked this pull request as draft October 26, 2020 05:08
Comment on lines +1 to +3
//
// Created by Administrator on 2020/10/12.
//
Copy link
Contributor Author

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();
Copy link
Contributor Author

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;
Copy link
Contributor Author

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();
Copy link
Contributor Author

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);
Copy link
Contributor Author

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 ?
Copy link
Contributor Author

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());
Copy link
Contributor Author

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();
Copy link
Contributor Author

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);
Copy link
Contributor Author

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.

Copy link
Contributor Author

@er1cthe0ne er1cthe0ne left a 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.

zhangml pushed a commit to zhangml/alcor-control-agent that referenced this pull request Dec 7, 2020
…#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
@er1cthe0ne
Copy link
Contributor Author

closing this old draft PR.

@er1cthe0ne er1cthe0ne closed this Dec 7, 2020
@er1cthe0ne er1cthe0ne reopened this Mar 17, 2021
@er1cthe0ne
Copy link
Contributor Author

Here is my additional comments on this draft security group implementation:

  1. current code will store all the local ports to SG relationship/data, and also remote ports info in ACA to support remote SG rules, we want to think about how to leverage the new NCM implementation to make it easier for ACA, so that ACA doesn't need to store so much data
  2. what is conj_offset and Reg_NET used for?
  3. I noticed there is a good set of test cases with this PR, what is working and what is not working?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants