Fix patch apply changes 60/9160/3
authornaman.gupta <naman.gupta@samsung.com>
Mon, 3 Oct 2022 10:35:10 +0000 (16:05 +0530)
committernaman.gupta <naman.gupta@samsung.com>
Thu, 6 Oct 2022 05:58:14 +0000 (11:28 +0530)
Fixing typos error caused while applying patch

Signed-off-by: naman.gupta <naman.gupta@samsung.com>
Change-Id: I20c9d4e6c37de746195105d00b69cff03cb40c40

a1-go/pkg/resthooks/resthooks.go
a1-go/pkg/resthooks/resthooks_test.go

index 2767bda..45c3928 100644 (file)
@@ -213,7 +213,7 @@ func toStringKeys(val interface{}) (interface{}, error) {
        }
 }
 
-var validate(httpBodyString string, schemaString string) bool {
+func validate(httpBodyString string, schemaString string) bool {
        var m interface{}
        err := yaml.Unmarshal([]byte(httpBodyString), &m)
        if err != nil {
index 3afbb8e..da062aa 100644 (file)
@@ -158,7 +158,7 @@ func TestGetPolicyInstance(t *testing.T) {
           "blocking_rate":20,
                "trigger_threshold":10
                }`
-       instancekey := a1PolicyPrefix + strconv.FormatInt(20001, 10) + "." + string(policyInstanceID)
+       instancekey := a1InstancePrefix + strconv.FormatInt(20001, 10) + "." + string(policyInstanceID)
        a1.Logger.Debug("httpBody String : %+v", httpBody)
        a1.Logger.Debug("key   : %+v", instancekey)
        var keys [1]string
@@ -207,23 +207,15 @@ func (s *SdlMock) Get(ns string, keys []string) (map[string]interface{}, error)
                        }`
                key = a1InstancePrefix + strconv.FormatInt(policytypeid, 10) + "." + string(policyInstanceID)
        } else if keys[0] == "a1.policy_type.20001" {
-               policySchemaString = `{"name":"admission_control_policy_mine",
-               "description":"various parameters to control admission of dual connection",
-               "policy_type_id": 20001,
-               "create_schema":{"$schema": "http://json-schema.org/draft-07/schema#","type":    "object",
-               "properties": {"enforce": {"type":    "boolean","default": "true"},
-               "window_length": {"type":"integer","default":     1,"minimum":     1,"maximum":     60,
-               "description": "Sliding window length (in minutes)"},
-               "blocking_rate": {"type":        "number","default":     10,"minimum":     1,"maximum":     1001,
-               "description": "% Connections to block"},
-               "additionalProperties": false}}}`
+               policySchemaString = `{"create_schema":{"$schema":"http://json-schema.org/draft-07/schema#","properties":{"additionalProperties":false,"blocking_rate":{"default":10,"description":"% Connections to block","maximum":1001,"minimum":1,"type":"number"},"enforce":{"default":"true","type":"boolean"},"window_length":{"default":1,"description":"Sliding window length (in minutes)","maximum":60,"minimum":1,"type":"integer"}},"type":"object"},"description":"various parameters to control admission of dual connection","name":"admission_control_policy_mine","policy_type_id":20001}`
                key = a1PolicyPrefix + strconv.FormatInt((policytypeid), 10)
        }
        a1.Logger.Error(" policy SchemaString %+v", policySchemaString)
        policyTypeSchema, _ := json.Marshal((policySchemaString))
        a1.Logger.Error(" policyTypeSchema %+v", string(policyTypeSchema))
+
        a1.Logger.Error(" key for policy type %+v", key)
-       mp := map[string]interface{}{key: string(policyTypeSchema)}
+       mp := map[string]interface{}{key: string(policySchemaString)}
        a1.Logger.Error("Get Called and mp return %+v ", mp)
        return mp, nil
 }