diff --git a/services/settings/policy/policy_settings_test.go b/services/settings/policy/policy_settings_test.go index abcb070d..3d03a446 100644 --- a/services/settings/policy/policy_settings_test.go +++ b/services/settings/policy/policy_settings_test.go @@ -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", @@ -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", @@ -630,7 +630,8 @@ func TestUnmarshallWANs(t *testing.T) { BestOfMetric: "LOWEST_LATENCY", Criteria: []WANCriteriaType{ { - Type: "ALWAYS_UP", + Type: "ALWAYS_UP", + Attribute: "VPN", }, }, Interfaces: []WANInterfaceType{ @@ -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", @@ -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", diff --git a/services/settings/policy/wans.go b/services/settings/policy/wans.go index 7e5b4b4d..bdaaba7a 100644 --- a/services/settings/policy/wans.go +++ b/services/settings/policy/wans.go @@ -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 @@ -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"` }