-
Notifications
You must be signed in to change notification settings - Fork 0
aws sg analysis #648
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
aws sg analysis #648
Conversation
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.
few more comments
pkg/awsvpc/examples/out/analysis_out/config_object_all_vpcs_.txt
Outdated
Show resolved
Hide resolved
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.
can you add more examples and tests demonstrating sg analysis with non trivial SG rules?
|
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.
added few more comments
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.
can you capture common functionality of both parsers to common package? check duplicated code such as printing functions, code that handles the objects of the common types, etc.
|
||
/********** Functions used in Debug mode ***************/ | ||
|
||
func printVPCConfigs(c *vpcmodel.MultipleVPCConfigs) { |
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.
why can't all the printing functions be in commonvpc
?
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.
because it calls printConfigs func which is specific for each provider(for now)
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.
can't this function be common for all providers? it iterates over objects from vpcmodel pkg
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.
can't, because for ex in ibmvpc this function calls printTGWAvailableRoutes
which is specific for ibm and includes struct type that is in ibmvpc pkg.. if the struct were defined in commonvpc (it is not used in aws..) it will be possible to move the func to common-code
I can split the func to two functions.. but I think it is better leave it this way..
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.
ok, let's consider this for a followup PR
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.
Some initial comments (not done yet)
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.
comments on parser.go
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.
added comments to sg_analysis.go
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.
Added few comments
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.
Better have it in this PR. For one, I find it hard to understand the code without documentation.
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.
Few general comments
Wouldn't it be better to have a directory impl
or something in the spirit and have ibmvpc
and awsvpc
under it?
LGTM |
pkg/awsvpc/sg_analysis.go
Outdated
case commonvpc.ProtocolTCP: | ||
ruleStr, ruleRes, err = sga.getProtocolTCPUDPRule(&ruleObj, direction) | ||
case commonvpc.ProtocolUDP: | ||
ruleStr, ruleRes, err = sga.getProtocolTCPUDPRule(&ruleObj, direction) |
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.
case commonvpc.ProtocolTCP: | |
ruleStr, ruleRes, err = sga.getProtocolTCPUDPRule(&ruleObj, direction) | |
case commonvpc.ProtocolUDP: | |
ruleStr, ruleRes, err = sga.getProtocolTCPUDPRule(&ruleObj, direction) | |
case commonvpc.ProtocolTCP, commonvpc.ProtocolUDP: | |
ruleStr, ruleRes, err = sga.getProtocolTCPUDPRule(&ruleObj, direction) |
pkg/awsvpc/sg_analysis_test.go
Outdated
VPCRef: nil, | ||
Region: "", | ||
}, | ||
Analyzer: commonvpc.NewSGAnalyzer(NewAWSSGAnalyzer(&sg)), Members: nil, |
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.
vscode warning: unused write to field Members
pkg/awsvpc/sg_analysis_test.go
Outdated
VPCRef: nil, | ||
Region: "", | ||
}, | ||
Analyzer: commonvpc.NewSGAnalyzer(NewAWSSGAnalyzer(&sg)), Members: nil, |
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.
vscode warning: unused write to field Members
pkg/commonvpc/vpc.go
Outdated
"github.com/np-guard/vpc-network-config-analyzer/pkg/vpcmodel" | ||
) | ||
|
||
const DoubleTab = "\t\t" |
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 const is only used in ibmvpc
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.
consider for a followup PR:
- avoid duplication of analysis_output_test
- add documentation where missing
- capture more common functionality where possible
|
No description provided.