Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add firewall sequence number when adding relations
Change-Id: I026b5288b56c926c06ebe332c332ae65e56658d6 Closes-Bug: #1781621
- Loading branch information
1 parent
fba436c
commit 1df4958
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
o11nplugin-contrail-workflows/src/main/js/workflows/addFirewallPolicyToAPS.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var policies = item.getFirewallPolicy(); | ||
var count = 0; | ||
if (policies){ | ||
count = policies.length; | ||
} | ||
var sequence = new ContrailFirewallSequence(count.toString()); | ||
|
||
item.addFirewallPolicy(child, sequence); | ||
|
||
item.update(); |
10 changes: 10 additions & 0 deletions
10
o11nplugin-contrail-workflows/src/main/js/workflows/addFirewallRuleToFirewallPolicy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
var rules = item.getFirewallRule(); | ||
var count = 0; | ||
if (rules){ | ||
count = rules.length; | ||
} | ||
var sequence = new ContrailFirewallSequence(count.toString()); | ||
|
||
item.addFirewallRule(child, sequence); | ||
|
||
item.update(); |
34 changes: 34 additions & 0 deletions
34
...rkflows/src/main/kotlin/net/juniper/contrail/vro/workflows/custom/ApplicationPolicySet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.workflows.custom | ||
|
||
import net.juniper.contrail.api.types.ApplicationPolicySet | ||
import net.juniper.contrail.api.types.FirewallPolicy | ||
import net.juniper.contrail.vro.config.constants.child | ||
import net.juniper.contrail.vro.config.constants.item | ||
import net.juniper.contrail.vro.schema.Schema | ||
import net.juniper.contrail.vro.workflows.dsl.WorkflowDefinition | ||
import net.juniper.contrail.vro.workflows.dsl.parentConnection | ||
import net.juniper.contrail.vro.workflows.model.reference | ||
import net.juniper.contrail.vro.workflows.util.childDescriptionInCreateRelation | ||
import net.juniper.contrail.vro.workflows.util.parentDescriptionInCreateRelation | ||
|
||
internal fun addFirewallPolicyToAPS(schema: Schema): WorkflowDefinition { | ||
|
||
val workflowName = "Add firewall policy to application policy set" | ||
|
||
return customWorkflow<ApplicationPolicySet>(workflowName).withScriptFile("addFirewallPolicyToAPS") { | ||
parameter(item, reference<ApplicationPolicySet>()) { | ||
description = schema.parentDescriptionInCreateRelation<ApplicationPolicySet, FirewallPolicy>() | ||
mandatory = true | ||
browserRoot = child.parentConnection | ||
} | ||
parameter(child, reference<FirewallPolicy>()) { | ||
description = schema.childDescriptionInCreateRelation<ApplicationPolicySet, FirewallPolicy>() | ||
mandatory = true | ||
browserRoot = item.parentConnection | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...ail-workflows/src/main/kotlin/net/juniper/contrail/vro/workflows/custom/FirewallPolicy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2018 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
package net.juniper.contrail.vro.workflows.custom | ||
|
||
import net.juniper.contrail.api.types.FirewallPolicy | ||
import net.juniper.contrail.api.types.FirewallRule | ||
import net.juniper.contrail.vro.config.constants.child | ||
import net.juniper.contrail.vro.config.constants.item | ||
import net.juniper.contrail.vro.schema.Schema | ||
import net.juniper.contrail.vro.workflows.dsl.WorkflowDefinition | ||
import net.juniper.contrail.vro.workflows.dsl.parentConnection | ||
import net.juniper.contrail.vro.workflows.model.reference | ||
import net.juniper.contrail.vro.workflows.util.childDescriptionInCreateRelation | ||
import net.juniper.contrail.vro.workflows.util.parentDescriptionInCreateRelation | ||
|
||
internal fun addFirewallRuleToFirewallPolicy(schema: Schema): WorkflowDefinition { | ||
|
||
val workflowName = "Add firewall rule to firewall policy" | ||
|
||
return customWorkflow<FirewallPolicy>(workflowName).withScriptFile("addFirewallRuleToFirewallPolicy") { | ||
parameter(item, reference<FirewallPolicy>()) { | ||
description = schema.parentDescriptionInCreateRelation<FirewallPolicy, FirewallRule>() | ||
mandatory = true | ||
browserRoot = child.parentConnection | ||
} | ||
parameter(child, reference<FirewallRule>()) { | ||
description = schema.childDescriptionInCreateRelation<FirewallPolicy, FirewallRule>() | ||
mandatory = true | ||
browserRoot = item.parentConnection | ||
} | ||
} | ||
} |