Skip to content
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

feat: New movement implementation #123

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
055d724
feat: LCS-based movement implementation
kklimonda-cl Jul 31, 2024
90963b8
Updated LCS implementation and added OptimizeMovements step
kklimonda-cl Aug 1, 2024
86a73c1
Some fixes around generation and optimization of move actions
kklimonda-cl Aug 1, 2024
06847fb
Implement support for PositionAfter and some clean-up
kklimonda-cl Aug 1, 2024
be9aa94
Remove some debug logging
kklimonda-cl Aug 1, 2024
2ef650f
Fixes to PositionAfter expected sequence generation
kklimonda-cl Aug 1, 2024
d2e3eed
Rewrite GenerateMovements() to work without LCS algorithm
kklimonda-cl Aug 2, 2024
b010b2c
Fix edge cases in GenerateMovements() and OptimizeMovements() interac…
kklimonda-cl Aug 2, 2024
583fc99
Update movement code to better fit terraform provider
kklimonda-cl Sep 3, 2024
2fdaa61
Update SDK and Provider code to use new movement API
kklimonda-cl Sep 3, 2024
fb7d426
Merge remote-tracking branch 'origin/main' into feat-movement-impl
kklimonda-cl Jan 14, 2025
532d1bb
Update terraform code to use new movement implementation
kklimonda-cl Jan 14, 2025
4d6e83b
When calling CreateMany() on uuid-style resources, make sure order is…
kklimonda-cl Jan 14, 2025
c3a84ec
Update acceptance tests to better verify entries order on the server …
kklimonda-cl Jan 14, 2025
79b6df2
Merge remote-tracking branch 'origin/main' into feat-movement-impl
kklimonda-cl Jan 27, 2025
432dbc1
Update pango example for the new movement API
kklimonda-cl Jan 27, 2025
23ef3c9
Update tests for the new movement API
kklimonda-cl Feb 4, 2025
e4133eb
Verify that all entries from plan have unique names
kklimonda-cl Feb 4, 2025
b572b23
Update tests to not use map for location
kklimonda-cl Feb 5, 2025
8f07964
Add validation of name uniqueness in uuid resources
kklimonda-cl Feb 5, 2025
63bbb0a
Enable cpu profiling
kklimonda-cl Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions assets/pango/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/PaloAltoNetworks/pango"
"github.com/PaloAltoNetworks/pango/device/services/dns"
"github.com/PaloAltoNetworks/pango/device/services/ntp"
"github.com/PaloAltoNetworks/pango/movement"
"github.com/PaloAltoNetworks/pango/network/interface/ethernet"
"github.com/PaloAltoNetworks/pango/network/interface/loopback"
"github.com/PaloAltoNetworks/pango/network/profiles/interface_management"
Expand All @@ -23,7 +24,6 @@ import (
"github.com/PaloAltoNetworks/pango/panorama/template"
"github.com/PaloAltoNetworks/pango/panorama/template_stack"
"github.com/PaloAltoNetworks/pango/policies/rules/security"
"github.com/PaloAltoNetworks/pango/rule"
"github.com/PaloAltoNetworks/pango/util"
)

Expand Down Expand Up @@ -773,22 +773,11 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) {
log.Printf("Security policy rule '%s:%s' with description '%s' created", *securityPolicyRuleItemReply.Uuid, securityPolicyRuleItemReply.Name, *securityPolicyRuleItemReply.Description)
}

rulePositionBefore7 := rule.Position{
First: nil,
Last: nil,
SomewhereBefore: nil,
DirectlyBefore: util.String("codegen_rule7"),
SomewhereAfter: nil,
DirectlyAfter: nil,
}
rulePositionBottom := rule.Position{
First: nil,
Last: util.Bool(true),
SomewhereBefore: nil,
DirectlyBefore: nil,
SomewhereAfter: nil,
DirectlyAfter: nil,
positionBefore7 := movement.PositionBefore{
Directly: true,
Pivot: "codegen_rule7",
}
positionLast := movement.PositionLast{}

var securityPolicyRulesEntriesToMove []*security.Entry
securityPolicyRulesEntriesToMove = append(securityPolicyRulesEntriesToMove, securityPolicyRulesEntries[3])
Expand All @@ -797,7 +786,7 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) {
for _, securityPolicyRuleItemToMove := range securityPolicyRulesEntriesToMove {
log.Printf("Security policy rule '%s' is going to be moved", securityPolicyRuleItemToMove.Name)
}
err := securityPolicyRuleApi.MoveGroup(ctx, *securityPolicyRuleLocation, rulePositionBefore7, securityPolicyRulesEntriesToMove)
err := securityPolicyRuleApi.MoveGroup(ctx, *securityPolicyRuleLocation, positionBefore7, securityPolicyRulesEntriesToMove)
if err != nil {
log.Printf("Failed to move security policy rules %v: %s", securityPolicyRulesEntriesToMove, err)
return
Expand All @@ -807,7 +796,7 @@ func checkSecurityPolicyRulesMove(c *pango.Client, ctx context.Context) {
for _, securityPolicyRuleItemToMove := range securityPolicyRulesEntriesToMove {
log.Printf("Security policy rule '%s' is going to be moved", securityPolicyRuleItemToMove.Name)
}
err = securityPolicyRuleApi.MoveGroup(ctx, *securityPolicyRuleLocation, rulePositionBottom, securityPolicyRulesEntriesToMove)
err = securityPolicyRuleApi.MoveGroup(ctx, *securityPolicyRuleLocation, positionLast, securityPolicyRulesEntriesToMove)
if err != nil {
log.Printf("Failed to move security policy rules %v: %s", securityPolicyRulesEntriesToMove, err)
return
Expand Down
Loading
Loading