Skip to content

Commit

Permalink
minor reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiriMoran committed Dec 19, 2024
1 parent f44b339 commit a8380bb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/synthesis/synthesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@ func NSXSynthesis(recourses *collector.ResourcesContainerModel, params model.Out
return "", err
}
config := parser.GetConfig()
policy := symbolicPolicy{}
policy.inbound, policy.outbound = preProcessing(config.Fw.CategoriesSpecs)
policy := preProcessing(config.Fw.CategoriesSpecs)
fmt.Println(policy.string())
return "", nil
}

// preProcessing: convert policy from spec to symbolicPolicy struct
func preProcessing(categoriesSpecs []*dfw.CategorySpec) (inbound, outbound []*symbolicRule) {
func preProcessing(categoriesSpecs []*dfw.CategorySpec) (policy symbolicPolicy) {
policy = symbolicPolicy{}
for _, category := range categoriesSpecs {
if len(category.ProcessedRules.Outbound)+len(category.ProcessedRules.Inbound) == 0 {
continue
}
inbound = append(inbound, convertRulesToSymbolicPaths(category.ProcessedRules.Inbound, category.Category)...)
outbound = append(outbound, convertRulesToSymbolicPaths(category.ProcessedRules.Outbound, category.Category)...)
policy.inbound = append(policy.inbound, convertRulesToSymbolicPaths(category.ProcessedRules.Inbound,
category.Category)...)
policy.outbound = append(policy.outbound, convertRulesToSymbolicPaths(category.ProcessedRules.Outbound,
category.Category)...)
}
return inbound, outbound
return policy
}

func convertRulesToSymbolicPaths(rules []*dfw.FwRule, category dfw.DfwCategory) []*symbolicRule {
Expand Down

0 comments on commit a8380bb

Please sign in to comment.