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

Patch file changes and updating test case based on YANG model update #322

Merged
merged 5 commits into from
Dec 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ cd $(BUILD_GOPATH)/src/github.com/golang/glog; git checkout 23def4e6c14b4da8ac2e
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/golang/glog; \
cd $(BUILD_GOPATH)/src/github.com/pkg/profile; git checkout acd64d450fd45fb2afa41f833f3788c8a7797219 2>/dev/null ; true; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/pkg/profile; \
cd $(BUILD_GOPATH)/src/github.com/antchfx/jsonquery; git checkout 3535127d6ca5885dbf650204eb08eabf8374a274 2>/dev/null ; true; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/antchfx/jsonquery; \
cd $(BUILD_GOPATH)/src/github.com/antchfx/xmlquery; git checkout 16f1e6cdc5fe44a7f8e2a8c9faf659a1b3a8fd9b 2>/dev/null ; true; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/antchfx/xmlquery; \
cd $(BUILD_GOPATH)/src/github.com/facette/natsort; git checkout 2cd4dd1e2dcba4d85d6d3ead4adf4cfd2b70caf2 2>/dev/null ; true; \
Expand Down Expand Up @@ -122,7 +120,11 @@ $(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/ygot
cd $(BUILD_GOPATH)/src/github.com/openconfig/goyang/; git reset --hard HEAD; git checkout 064f9690516f4f72db189f4690b84622c13b7296 >/dev/null ; true; \
cp $(TOPDIR)/goyang-modified-files/goyang.patch .; \
patch -p1 < goyang.patch; rm -f goyang.patch; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/goyang
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/goyang; \
cd $(BUILD_GOPATH)/src/github.com/antchfx/jsonquery; git reset --hard HEAD; \
git checkout 3535127d6ca5885dbf650204eb08eabf8374a274 2>/dev/null ; \
git apply $(TOPDIR)/patches/jsonquery.patch; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/antchfx/jsonquery

install:
$(INSTALL) -D $(REST_BIN) $(DESTDIR)/usr/sbin/rest_server
Expand Down
14 changes: 14 additions & 0 deletions patches/jsonquery.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node.go b/node.go
index 76032bb..db73a1e 100644
--- a/node.go
+++ b/node.go
@@ -155,3 +155,9 @@ func Parse(r io.Reader) (*Node, error) {
}
return parse(b)
}
+
+func ParseJsonMap(jsonMap *map[string]interface{}) (*Node, error) {
+ doc := &Node{Type: DocumentNode}
+ parseValue(*jsonMap, doc, 1)
+ return doc, nil
+}
7 changes: 0 additions & 7 deletions src/cvl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ deps: $(BUILD_DIR)/.deps $(CVL_PKG) $(CVL_TEST_BIN)


$(BUILD_DIR)/.deps:
# Patch code
@grep ParseJsonMap $(GO_DOWNLOAD_PATH)/src/github.com/antchfx/jsonquery/node.go || \
printf "\nfunc ParseJsonMap(jsonMap *map[string]interface{}) (*Node, error) {\n \
doc := &Node{Type: DocumentNode}\n \
parseValue(*jsonMap, doc, 1)\n \
return doc, nil\n \
}\n" >> $(GO_DOWNLOAD_PATH)/src/github.com/antchfx/jsonquery/node.go
touch $@

$(CVL_PKG):
Expand Down
11 changes: 11 additions & 0 deletions src/cvl/cvl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,13 @@ func TestValidateEditConfig_Delete_Must_Check_Positive(t *testing.T) {
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "3",
},
"Ethernet5" : map[string]interface{} {
"alias":"hundredGigE1",
"lanes": "85,86,87,89",
"mtu": "9100",
"index": "5",
},
},
"ACL_TABLE" : map[string]interface{} {
Expand Down Expand Up @@ -2417,11 +2419,13 @@ func TestValidateEditConfig_Create_Chained_Leafref_DepData_Positive(t *testing.T
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "1",
},
"Ethernet2" : map[string]interface{} {
"alias":"hundredGigE1",
"lanes": "85,86,87,89",
"mtu": "9100",
"index": "2",
},
},
"ACL_TABLE" : map[string]interface{} {
Expand Down Expand Up @@ -2543,11 +2547,13 @@ func TestValidateEditConfig_Create_Chained_Leafref_DepData_Negative(t *testing.T
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "3",
},
"Ethernet5" : map[string]interface{} {
"alias":"hundredGigE1",
"lanes": "85,86,87,89",
"mtu": "9100",
"index": "5",
},
},
"ACL_TABLE" : map[string]interface{} {
Expand Down Expand Up @@ -2649,11 +2655,13 @@ func TestValidateEditConfig_DepData_Through_Cache(t *testing.T) {
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "3",
},
"Ethernet5" : map[string]interface{} {
"alias":"hundredGigE1",
"lanes": "85,86,87,89",
"mtu": "9100",
"index": "5",
},
},
}
Expand Down Expand Up @@ -2962,6 +2970,7 @@ func TestValidateEditConfig_Delete_Create_Same_Entry_Positive(t *testing.T) {
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "1",
},
},
}
Expand Down Expand Up @@ -3038,11 +3047,13 @@ func TestValidateIncrementalConfig_Positive(t *testing.T) {
"alias":"hundredGigE1",
"lanes": "81,82,83,84",
"mtu": "9100",
"index": "1",
},
"Ethernet2" : map[string]interface{} {
"alias":"hundredGigE1",
"lanes": "85,86,87,89",
"mtu": "9100",
"index": "2",
},
},
}
Expand Down
96 changes: 64 additions & 32 deletions src/cvl/testdata/port_table.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,163 @@
"PORT": {
"Ethernet0": {
"alias": "fortyGigE0/0",
"lanes": "29,30,31,32"
"lanes": "29,30,31,32",
"index": "0"
},
"Ethernet4": {
"alias": "fortyGigE0/4",
"lanes": "25,26,27,28"
"lanes": "25,26,27,28",
"index": "1"
},
"Ethernet8": {
"alias": "fortyGigE0/8",
"lanes": "37,38,39,40"
"lanes": "37,38,39,40",
"index": "2"
},
"Ethernet12": {
"alias": "fortyGigE0/12",
"lanes": "33,34,35,36"
"lanes": "33,34,35,36",
"index": "3"
},
"Ethernet16": {
"alias": "fortyGigE0/16",
"lanes": "41,42,43,44"
"lanes": "41,42,43,44",
"index": "4"
},
"Ethernet20": {
"alias": "fortyGigE0/20",
"lanes": "45,46,47,48"
"lanes": "45,46,47,48",
"index": "5"
},
"Ethernet24": {
"alias": "fortyGigE0/24",
"lanes": "5,6,7,8"
"lanes": "5,6,7,8",
"index": "6"
},
"Ethernet28": {
"alias": "fortyGigE0/28",
"lanes": "1,2,3,4"
"lanes": "1,2,3,4",
"index": "7"
},
"Ethernet32": {
"alias": "fortyGigE0/32",
"lanes": "9,10,11,12"
"lanes": "9,10,11,12",
"index": "8"
},
"Ethernet36": {
"alias": "fortyGigE0/36",
"lanes": "13,14,15,16"
"lanes": "13,14,15,16",
"index": "9"
},
"Ethernet40": {
"alias": "fortyGigE0/40",
"lanes": "21,22,23,24"
"lanes": "21,22,23,24",
"index": "10"
},
"Ethernet44": {
"alias": "fortyGigE0/44",
"lanes": "17,18,19,20"
"lanes": "17,18,19,20",
"index": "11"
},
"Ethernet48": {
"alias": "fortyGigE0/48",
"lanes": "49,50,51,52"
"lanes": "49,50,51,52",
"index": "12"
},
"Ethernet52": {
"alias": "fortyGigE0/52",
"lanes": "53,54,55,56"
"lanes": "53,54,55,56",
"index": "13"
},
"Ethernet56": {
"alias": "fortyGigE0/56",
"lanes": "61,62,63,64"
"lanes": "61,62,63,64",
"index": "14"
},
"Ethernet60": {
"alias": "fortyGigE0/60",
"lanes": "57,58,59,60"
"lanes": "57,58,59,60",
"index": "15"
},
"Ethernet64": {
"alias": "fortyGigE0/64",
"lanes": "65,66,67,68"
"lanes": "65,66,67,68",
"index": "16"
},
"Ethernet68": {
"alias": "fortyGigE0/68",
"lanes": "69,70,71,72"
"lanes": "69,70,71,72",
"index": "17"
},
"Ethernet72": {
"alias": "fortyGigE0/72",
"lanes": "77,78,79,80"
"lanes": "77,78,79,80",
"index": "18"
},
"Ethernet76": {
"alias": "fortyGigE0/76",
"lanes": "73,74,75,76"
"lanes": "73,74,75,76",
"index": "19"
},
"Ethernet80": {
"alias": "fortyGigE0/80",
"lanes": "105,106,107,108"
"lanes": "105,106,107,108",
"index": "20"
},
"Ethernet84": {
"alias": "fortyGigE0/84",
"lanes": "109,110,111,112"
"lanes": "109,110,111,112",
"index": "21"
},
"Ethernet88": {
"alias": "fortyGigE0/88",
"lanes": "117,118,119,120"
"lanes": "117,118,119,120",
"index": "22"
},
"Ethernet92": {
"alias": "fortyGigE0/92",
"lanes": "113,114,115,116"
"lanes": "113,114,115,116",
"index": "23"
},
"Ethernet96": {
"alias": "fortyGigE0/96",
"lanes": "121,122,123,124"
"lanes": "121,122,123,124",
"index": "24"
},
"Ethernet100": {
"alias": "fortyGigE0/100",
"lanes": "125,126,127,128"
"lanes": "125,126,127,128",
"index": "25"
},
"Ethernet104": {
"alias": "fortyGigE0/104",
"lanes": "85,86,87,88"
"lanes": "85,86,87,88",
"index": "26"
},
"Ethernet108": {
"alias": "fortyGigE0/108",
"lanes": "81,82,83,84"
"lanes": "81,82,83,84",
"index": "27"
},
"Ethernet112": {
"alias": "fortyGigE0/112",
"lanes": "89,90,91,92"
"lanes": "89,90,91,92",
"index": "28"
},
"Ethernet116": {
"alias": "fortyGigE0/116",
"lanes": "93,94,95,96"
"lanes": "93,94,95,96",
"index": "29"
},
"Ethernet120": {
"alias": "fortyGigE0/120",
"lanes": "97,98,99,100"
"lanes": "97,98,99,100",
"index": "30"
},
"Ethernet124": {
"alias": "fortyGigE0/124",
"lanes": "101,102,103,104"
"lanes": "101,102,103,104",
"index": "31"
}
}
}
Expand Down