Skip to content

Commit

Permalink
mfw-3975 (#326)
Browse files Browse the repository at this point in the history
version: bug
  • Loading branch information
abriles1216 authored Dec 5, 2023
1 parent b627f64 commit 4d4b93d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
67 changes: 34 additions & 33 deletions services/settings/policy/policy_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ func TestRulesUnmarshal(t *testing.T) {
ID: "c2428365-65be-4901-bfc0-bde2b310fedf",
},
},

{
name: "bad rule object type",
json: `{"name": "Geo Rule Tester",
Expand Down Expand Up @@ -599,21 +598,22 @@ func TestUnmarshallWANs(t *testing.T) {
"type": "mfw-config-wanpolicy",
"description": "My WAN description",
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"settings":
{
"settings":
{
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"best_of_metric": "LOWEST_LATENCY",
"criteria": [
{
"type": "ALWAYS_UP"
}
],
"interfaces": [
{
"criteria": [
{
"type": "ALWAYS_UP",
"attribute": "VPN"
}
],
"interfaces": [
{
"interfaceId": 0
}
],
"type": "BEST_OF"
],
"type": "BEST_OF"
},
"action": {
"type": "WAN_POLICY",
Expand All @@ -630,7 +630,8 @@ func TestUnmarshallWANs(t *testing.T) {
BestOfMetric: "LOWEST_LATENCY",
Criteria: []WANCriteriaType{
{
Type: "ALWAYS_UP",
Type: "ALWAYS_UP",
Attribute: "VPN",
},
},
Interfaces: []WANInterfaceType{
Expand All @@ -654,21 +655,21 @@ func TestUnmarshallWANs(t *testing.T) {
"type": "mfw-config-wanpolicy",
"description": "My WAN description",
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"settings":
{
"settings":
{
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"best_of_metric": "LOWEST_LATENCY",
"criteria": [
{
"criteria": [
{
"type": "ALWAYS_UP"
}
],
"interfaces": [
{
}
],
"interfaces": [
{
"interfaceId": 0
}
],
"type": "BEST_OF"
],
"type": "BEST_OF"
},
"action": {
"type": "WAN_POLICY",
Expand Down Expand Up @@ -709,21 +710,21 @@ func TestUnmarshallWANs(t *testing.T) {
"type": "mfw-config-wanpolicy",
"description": "My WAN description",
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"settings":
{
"settings":
{
"policyId": "c2428365-65be-4901-bfc0-bde2b310fedf",
"best_of_metric": "LOWEST_LATENCY",
"criteria": [
{
"criteria": [
{
"type": "ALWAYS_UP"
}
],
"interfaces": [
{
}
],
"interfaces": [
{
"interfaceId": 0
}
],
"type": "BEST_OF"
],
"type": "BEST_OF"
},
"action": {
"type": "WAN_POLICY",
Expand Down
5 changes: 4 additions & 1 deletion services/settings/policy/wans.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package policy

// WANCriteriaType is a type of WAN criteria
type WANCriteriaType struct {
Type string `json:"type"`
Type string `json:"type"`
Attribute string `json:"attribute"`
}

// WANInterfaceType is a type of WAN interface
Expand All @@ -19,4 +20,6 @@ type WANPolicySettings struct {
Interfaces []WANInterfaceType `json:"interfaces"`
Type string `json:"type"`
BestOfMetric string `json:"best_of_metric"`
Description string `json:"description"`
Name string `json:"name"`
}

0 comments on commit 4d4b93d

Please sign in to comment.