Skip to content

Commit

Permalink
Nsx demo example abstract model (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiriMoran authored Jan 9, 2025
1 parent 164fbcb commit b7a6e34
Show file tree
Hide file tree
Showing 10 changed files with 514 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/symbolicexpr/symbolicPath.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (path *SymbolicPath) removeRedundant(hints *Hints) *SymbolicPath {
// the resulting allow paths in SymbolicPaths
// The motivation here is to unroll allow rule given higher priority deny rule
// computation for each allow symbolicPath:
// computeAllowGivenAllowHigherDeny is called iteratively for each deny path, on applied on the previous result
// computeAllowGivenAllowHigherDeny is called iteratively for each deny path, applied on the previous result
// the result is the union of the above computation for each allow path
// if there are no allow paths then no paths are allowed - the empty set will be returned
// if there are no deny paths then allowPaths are returned as is
Expand Down
33 changes: 28 additions & 5 deletions pkg/synthesis/synthesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,44 @@ const (
type synthesisTest struct {
name string
exData tests.ExampleSynthesis
Mode testMode
noHint bool // run also with no hint
}

var allTests = []synthesisTest{
{
name: "ExampleDumbeldore",
exData: tests.ExampleDumbeldore,
noHint: true,
},
{
name: "ExampleTwoDeniesSimple",
exData: tests.ExampleTwoDeniesSimple,
noHint: true,
},
{
name: "ExampleDenyPassSimple",
exData: tests.ExampleDenyPassSimple,
noHint: true,
},
{
name: "ExampleHintsDisjoint",
exData: tests.ExampleHintsDisjoint,
noHint: true,
},
{
name: "ExampleHogwartsSimpler",
exData: tests.ExampleHogwartsSimpler,
noHint: true,
},
{
name: "ExampleHogwartsNoDumbledore",
exData: tests.ExampleHogwartsNoDumbledore,
noHint: false,
},
{
name: "ExampleHogwarts",
exData: tests.ExampleHogwarts,
noHint: false,
},
}

Expand All @@ -76,9 +95,9 @@ func TestPreprocessing(t *testing.T) {
for i := range allTests {
test := &allTests[i]
// to generate output comment the following line and uncomment the one after
test.runPreprocessing(t, OutputComparison)
//test.runPreprocessing(t, OutputComparison)
//nolint:gocritic // uncomment for generating output
//test.runPreprocessing(t, OutputGeneration)
test.runPreprocessing(t, OutputGeneration)
}
}

Expand Down Expand Up @@ -126,10 +145,14 @@ func TestConvertToAbsract(t *testing.T) {
test := &allTests[i]
// to generate output comment the following line and uncomment the one after
test.runConvertToAbstract(t, OutputComparison, true)
test.runConvertToAbstract(t, OutputComparison, false)
if test.noHint {
test.runConvertToAbstract(t, OutputComparison, false)
}
//nolint:gocritic // uncomment for generating output
//test.runConvertToAbstract(t, OutputGeneration, true)
//test.runConvertToAbstract(t, OutputGeneration, false)
//if test.noHint {
// test.runConvertToAbstract(t, OutputGeneration, false)
//}
}
}

Expand Down
Loading

0 comments on commit b7a6e34

Please sign in to comment.