From 97ffbddee07b96e5778b93d74b73244b617cccc0 Mon Sep 17 00:00:00 2001 From: Prabhu Sreenivasan Date: Tue, 17 Sep 2019 05:29:50 -0700 Subject: [PATCH 01/13] fix license header --- Makefile | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d2f9b1fe07..d7b93967ea 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,21 @@ -####################################################################### -# -# Copyright 2019 Broadcom. All rights reserved. -# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -# -####################################################################### +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ .PHONY: all clean cleanall codegen rest-server rest-clean yamlGen cli From e1721a3045b7575570d6488f5188a168078e2758 Mon Sep 17 00:00:00 2001 From: Sachin Holla Date: Tue, 17 Sep 2019 06:18:13 -0700 Subject: [PATCH 02/13] Updated license statement for REST server sources --- models/Makefile | 24 ++++++++++++++----- models/yang/Makefile | 24 ++++++++++++++----- src/rest/Makefile | 24 ++++++++++++++----- src/rest/main/main.go | 24 ++++++++++++++----- src/rest/main/main_test.go | 19 +++++++++++++++ src/rest/server/context.go | 24 ++++++++++++++----- src/rest/server/context_test.go | 24 ++++++++++++++----- src/rest/server/error.go | 24 ++++++++++++++----- src/rest/server/error_test.go | 24 ++++++++++++++----- src/rest/server/handler.go | 24 ++++++++++++++----- src/rest/server/handler_test.go | 24 ++++++++++++++----- src/rest/server/pamAuth.go | 19 +++++++++++++++ src/rest/server/pamAuth_test.go | 23 ++++++++++++++---- src/rest/server/req_validate.go | 24 ++++++++++++++----- src/rest/server/router.go | 24 ++++++++++++++----- .../go-server/src/swagger/routes.go | 23 ++++++++++++++---- 16 files changed, 290 insertions(+), 82 deletions(-) diff --git a/models/Makefile b/models/Makefile index fa432ca938..8f542e905d 100644 --- a/models/Makefile +++ b/models/Makefile @@ -1,9 +1,21 @@ -####################################################################### -# -# Copyright 2019 Broadcom. All rights reserved. -# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -# -####################################################################### +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ TOPDIR := .. ABS_TOPDIR := $(abspath $(TOPDIR)) diff --git a/models/yang/Makefile b/models/yang/Makefile index 721feecb21..228fa75751 100644 --- a/models/yang/Makefile +++ b/models/yang/Makefile @@ -1,9 +1,21 @@ -####################################################################### -# -# Copyright 2019 Broadcom. All rights reserved. -# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -# -####################################################################### +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ TOPDIR := ../.. BUILD_DIR := $(TOPDIR)/build diff --git a/src/rest/Makefile b/src/rest/Makefile index 1eb352a88d..9f1e4c6ff1 100644 --- a/src/rest/Makefile +++ b/src/rest/Makefile @@ -1,9 +1,21 @@ -####################################################################### -# -# Copyright 2019 Broadcom. All rights reserved. -# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -# -####################################################################### +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ TOPDIR ?= ../.. ABS_TOPDIR ?= $(abspath $(TOPDIR)) diff --git a/src/rest/main/main.go b/src/rest/main/main.go index 1c69290d38..e44056c733 100644 --- a/src/rest/main/main.go +++ b/src/rest/main/main.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package main diff --git a/src/rest/main/main_test.go b/src/rest/main/main_test.go index 2ab6a40702..50ee1010da 100644 --- a/src/rest/main/main_test.go +++ b/src/rest/main/main_test.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/rest/server/context.go b/src/rest/server/context.go index 2a7b4eb292..883679e343 100644 --- a/src/rest/server/context.go +++ b/src/rest/server/context.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/context_test.go b/src/rest/server/context_test.go index d4635e9668..1df7fc3857 100644 --- a/src/rest/server/context_test.go +++ b/src/rest/server/context_test.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/error.go b/src/rest/server/error.go index 3b05140975..0335e70eac 100644 --- a/src/rest/server/error.go +++ b/src/rest/server/error.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/error_test.go b/src/rest/server/error_test.go index 9ae5857dc8..7dfdfce3df 100644 --- a/src/rest/server/error_test.go +++ b/src/rest/server/error_test.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/handler.go b/src/rest/server/handler.go index 7b8c1eb036..5596c310f9 100644 --- a/src/rest/server/handler.go +++ b/src/rest/server/handler.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/handler_test.go b/src/rest/server/handler_test.go index eac69616c4..16e1ca21f5 100644 --- a/src/rest/server/handler_test.go +++ b/src/rest/server/handler_test.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/pamAuth.go b/src/rest/server/pamAuth.go index d726d35229..4ad9f0180e 100644 --- a/src/rest/server/pamAuth.go +++ b/src/rest/server/pamAuth.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package server import ( diff --git a/src/rest/server/pamAuth_test.go b/src/rest/server/pamAuth_test.go index 3726d895ce..d3015ea09d 100644 --- a/src/rest/server/pamAuth_test.go +++ b/src/rest/server/pamAuth_test.go @@ -1,8 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// // // Test cases for REST Server PAM Authentication module. // diff --git a/src/rest/server/req_validate.go b/src/rest/server/req_validate.go index d5a394f867..4571d8a100 100644 --- a/src/rest/server/req_validate.go +++ b/src/rest/server/req_validate.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/src/rest/server/router.go b/src/rest/server/router.go index 6442213965..aa01d193e5 100644 --- a/src/rest/server/router.go +++ b/src/rest/server/router.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package server diff --git a/tools/swagger_codegen/go-server/src/swagger/routes.go b/tools/swagger_codegen/go-server/src/swagger/routes.go index f21baa80f2..ce305b72aa 100644 --- a/tools/swagger_codegen/go-server/src/swagger/routes.go +++ b/tools/swagger_codegen/go-server/src/swagger/routes.go @@ -1,8 +1,21 @@ -/////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom Inc. -// -/////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package swagger From 6f63b84d020a54a9acfbf2b71bcabb5f49a2cd27 Mon Sep 17 00:00:00 2001 From: Partha Dutta Date: Tue, 17 Sep 2019 19:40:36 +0530 Subject: [PATCH 03/13] Update license header --- src/cvl/Makefile | 19 +++++++++++++++++++ src/cvl/cvl.go | 19 +++++++++++++++++++ src/cvl/cvl_api.go | 19 +++++++++++++++++++ src/cvl/cvl_luascript.go | 19 +++++++++++++++++++ src/cvl/cvl_test.go | 19 +++++++++++++++++++ src/cvl/internal/util/util.go | 19 +++++++++++++++++++ src/cvl/internal/yparser/yparser.go | 19 +++++++++++++++++++ src/cvl/jsondata_test.go | 19 +++++++++++++++++++ src/cvl/schema/Makefile | 19 +++++++++++++++++++ src/cvl/tests/Makefile | 19 +++++++++++++++++++ src/cvl/tests/cfg_validator.go | 19 +++++++++++++++++++ src/cvl/tests/cv_acl.go | 19 +++++++++++++++++++ src/cvl/tests/cv_edit_op.go | 19 +++++++++++++++++++ src/cvl/tests/cv_vlan.go | 19 +++++++++++++++++++ 14 files changed, 266 insertions(+) diff --git a/src/cvl/Makefile b/src/cvl/Makefile index 4f85259fc4..658ca0cf06 100644 --- a/src/cvl/Makefile +++ b/src/cvl/Makefile @@ -1,3 +1,22 @@ +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ + all: precheck deps schema tests GO?=/usr/local/go/bin/go SRC_FILES=$(shell find . -name '*.go' | grep -v '_test.go' | grep -v '/tests/') diff --git a/src/cvl/cvl.go b/src/cvl/cvl.go index f90486ecd9..7701372c7f 100644 --- a/src/cvl/cvl.go +++ b/src/cvl/cvl.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package cvl import ( "fmt" diff --git a/src/cvl/cvl_api.go b/src/cvl/cvl_api.go index 26bc6ea7f7..83b6842519 100644 --- a/src/cvl/cvl_api.go +++ b/src/cvl/cvl_api.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package cvl import ( diff --git a/src/cvl/cvl_luascript.go b/src/cvl/cvl_luascript.go index ac94c04db5..fd4c863ad1 100644 --- a/src/cvl/cvl_luascript.go +++ b/src/cvl/cvl_luascript.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package cvl import ( "github.com/go-redis/redis" diff --git a/src/cvl/cvl_test.go b/src/cvl/cvl_test.go index 74d51df3d0..3f5b0b3904 100644 --- a/src/cvl/cvl_test.go +++ b/src/cvl/cvl_test.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package cvl_test import ( diff --git a/src/cvl/internal/util/util.go b/src/cvl/internal/util/util.go index b57f8f1141..7404500d04 100644 --- a/src/cvl/internal/util/util.go +++ b/src/cvl/internal/util/util.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package util import ( diff --git a/src/cvl/internal/yparser/yparser.go b/src/cvl/internal/yparser/yparser.go index d08f66c702..2bc208fedf 100644 --- a/src/cvl/internal/yparser/yparser.go +++ b/src/cvl/internal/yparser/yparser.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package yparser /* Yang parser using libyang library */ diff --git a/src/cvl/jsondata_test.go b/src/cvl/jsondata_test.go index 65adaa8200..592ef71268 100644 --- a/src/cvl/jsondata_test.go +++ b/src/cvl/jsondata_test.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package cvl_test var json_edit_config_create_acl_table_dependent_data = []string{`{ diff --git a/src/cvl/schema/Makefile b/src/cvl/schema/Makefile index 1408bb1f58..8cd6016f0b 100644 --- a/src/cvl/schema/Makefile +++ b/src/cvl/schema/Makefile @@ -1,3 +1,22 @@ +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ + src_files=$(wildcard *.yang) out=$(patsubst %.yang, %.yin, $(src_files)) out_ext=$(patsubst %.yang, %.tree, $(src_files)) diff --git a/src/cvl/tests/Makefile b/src/cvl/tests/Makefile index 36ddbc1a33..3dda07a255 100644 --- a/src/cvl/tests/Makefile +++ b/src/cvl/tests/Makefile @@ -1,3 +1,22 @@ +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ + SRC_FILES=$(wildcard *.go) OUT=$(patsubst %.go, %, $(SRC_FILES)) TOPDIR := $(abspath ../../..) diff --git a/src/cvl/tests/cfg_validator.go b/src/cvl/tests/cfg_validator.go index b7be94fe89..f5a532da95 100644 --- a/src/cvl/tests/cfg_validator.go +++ b/src/cvl/tests/cfg_validator.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/cvl/tests/cv_acl.go b/src/cvl/tests/cv_acl.go index 0bb61e0478..cb12c0109b 100644 --- a/src/cvl/tests/cv_acl.go +++ b/src/cvl/tests/cv_acl.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/cvl/tests/cv_edit_op.go b/src/cvl/tests/cv_edit_op.go index 6eb65fa67f..a9035bcf51 100644 --- a/src/cvl/tests/cv_edit_op.go +++ b/src/cvl/tests/cv_edit_op.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/cvl/tests/cv_vlan.go b/src/cvl/tests/cv_vlan.go index d3e13c42dc..b230e86b5a 100644 --- a/src/cvl/tests/cv_vlan.go +++ b/src/cvl/tests/cv_vlan.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main From 31b70f2ad7aad4f032dbcfd763c1e573c3a5952a Mon Sep 17 00:00:00 2001 From: Faraaz Mohammed Date: Tue, 17 Sep 2019 19:56:05 +0530 Subject: [PATCH 04/13] update broadcom license for pyang plugin for openAPI --- tools/pyang/pyang_plugins/openapi.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tools/pyang/pyang_plugins/openapi.py b/tools/pyang/pyang_plugins/openapi.py index 649cb7e975..45a407d88d 100644 --- a/tools/pyang/pyang_plugins/openapi.py +++ b/tools/pyang/pyang_plugins/openapi.py @@ -1,6 +1,21 @@ -## Open Api Spec output plugin(swagger 2.0) -## Author: Mohammed Faraaz C -## Company: Broadcom Inc. +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ import optparse import sys From ae3ddf517ded00edfaca6b7d99f2486901d6fd6e Mon Sep 17 00:00:00 2001 From: Mayank Maheshwari Date: Tue, 17 Sep 2019 22:12:05 +0530 Subject: [PATCH 05/13] Updated License statement --- src/translib/acl_app.go | 24 ++++++++++++++++++------ src/translib/acl_app_test.go | 19 +++++++++++++++++++ src/translib/app_utils.go | 24 ++++++++++++++++++------ src/translib/nonyang_app.go.demo | 24 ++++++++++++++++++------ src/translib/path_utils.go | 24 ++++++++++++++++++------ src/translib/path_utils_test.go | 19 +++++++++++++++++++ src/translib/translib_test.go | 23 +++++++++++++++++++++-- 7 files changed, 131 insertions(+), 26 deletions(-) diff --git a/src/translib/acl_app.go b/src/translib/acl_app.go index f7e94af58f..0678cde7aa 100644 --- a/src/translib/acl_app.go +++ b/src/translib/acl_app.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package translib diff --git a/src/translib/acl_app_test.go b/src/translib/acl_app_test.go index 88065982b8..d1773866ac 100644 --- a/src/translib/acl_app_test.go +++ b/src/translib/acl_app_test.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package translib import ( diff --git a/src/translib/app_utils.go b/src/translib/app_utils.go index 90875968f7..0fa8b66fd3 100644 --- a/src/translib/app_utils.go +++ b/src/translib/app_utils.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package translib diff --git a/src/translib/nonyang_app.go.demo b/src/translib/nonyang_app.go.demo index 3e3a5f686e..17553ce328 100644 --- a/src/translib/nonyang_app.go.demo +++ b/src/translib/nonyang_app.go.demo @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package translib diff --git a/src/translib/path_utils.go b/src/translib/path_utils.go index 8d12ecdfcd..bf7a35dcab 100644 --- a/src/translib/path_utils.go +++ b/src/translib/path_utils.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package translib diff --git a/src/translib/path_utils_test.go b/src/translib/path_utils_test.go index 5379c00afa..e8d9c19b63 100644 --- a/src/translib/path_utils_test.go +++ b/src/translib/path_utils_test.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package translib import ( diff --git a/src/translib/translib_test.go b/src/translib/translib_test.go index 7d391757b2..9ceb1e1a80 100644 --- a/src/translib/translib_test.go +++ b/src/translib/translib_test.go @@ -1,10 +1,29 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package translib_test import ( "fmt" "path/filepath" - "runtime" "reflect" + "runtime" "testing" ) @@ -36,5 +55,5 @@ func equals(tb testing.TB, exp, act interface{}) { } func Test_Create(t *testing.T) { - + } From cafc7342009e291fb7079020558b555f1b90442d Mon Sep 17 00:00:00 2001 From: Anand Kumar Subramanian Date: Tue, 17 Sep 2019 12:20:38 -0700 Subject: [PATCH 06/13] Update broadcom license --- src/translib/app_interface.go | 24 ++++++++++++++++++------ src/translib/subscribe.go | 23 ++++++++++++++++++----- src/translib/test/translibtest.go | 19 +++++++++++++++++++ src/translib/translib.go | 26 ++++++++++++++++++-------- 4 files changed, 73 insertions(+), 19 deletions(-) diff --git a/src/translib/app_interface.go b/src/translib/app_interface.go index a64d568065..0a8b477403 100644 --- a/src/translib/app_interface.go +++ b/src/translib/app_interface.go @@ -1,8 +1,21 @@ -/////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom Inc. -// -/////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package translib defines the interface for all the app modules @@ -12,7 +25,6 @@ It exposes register function for all the app modules to register It stores all the app module information in a map and presents it to the tranlib infra when it asks for the same. - */ package translib diff --git a/src/translib/subscribe.go b/src/translib/subscribe.go index d48c9ac12d..a22e04c6e1 100644 --- a/src/translib/subscribe.go +++ b/src/translib/subscribe.go @@ -1,8 +1,21 @@ -/////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom Inc. -// -/////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package translib defines the functions to be used by the subscribe diff --git a/src/translib/test/translibtest.go b/src/translib/test/translibtest.go index 0d87d472d4..24450736b3 100644 --- a/src/translib/test/translibtest.go +++ b/src/translib/test/translibtest.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/translib/translib.go b/src/translib/translib.go index c482dc7567..3170128a21 100644 --- a/src/translib/translib.go +++ b/src/translib/translib.go @@ -1,8 +1,21 @@ -/////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom Inc. -// -/////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package translib implements APIs like Create, Get, Subscribe etc. @@ -16,9 +29,6 @@ Redis ABNF format and persisting them in the Redis DB. It can also translate the ABNF format to YANG specific JSON IETF format This package can also talk to non-DB clients. - -Example: TBD - */ package translib From 16a13061d2b74c4e64b857b9a9b1b508b8ca7de4 Mon Sep 17 00:00:00 2001 From: Arun Barboza <29963827+a-barboza@users.noreply.github.com> Date: Tue, 17 Sep 2019 11:58:58 -0700 Subject: [PATCH 07/13] DB Access Layer: Update Broadcom License --- src/translib/db/db.go | 22 ++++++++++++++++++---- src/translib/db/db_test.go | 22 ++++++++++++++++++---- src/translib/db/map.go | 22 ++++++++++++++++++---- src/translib/db/subscribe.go | 22 ++++++++++++++++++---- src/translib/db/test/arloIssue29.go | 19 +++++++++++++++++++ src/translib/db/test/testdb.go | 19 +++++++++++++++++++ src/translib/db/test/testmap.go | 19 +++++++++++++++++++ src/translib/db/test/testsubscribe.go | 19 +++++++++++++++++++ 8 files changed, 148 insertions(+), 16 deletions(-) diff --git a/src/translib/db/db.go b/src/translib/db/db.go index 804718dc8d..451bc92383 100644 --- a/src/translib/db/db.go +++ b/src/translib/db/db.go @@ -1,7 +1,21 @@ -/* -Copyright 2019 Broadcom. All rights reserved. -The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -*/ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package db implements a wrapper over the go-redis/redis. diff --git a/src/translib/db/db_test.go b/src/translib/db/db_test.go index 7f0030537b..edf05b281c 100644 --- a/src/translib/db/db_test.go +++ b/src/translib/db/db_test.go @@ -1,7 +1,21 @@ -/* -Copyright 2019 Broadcom. All rights reserved. -The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -*/ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package db diff --git a/src/translib/db/map.go b/src/translib/db/map.go index 63551b31c2..9010cfb15f 100644 --- a/src/translib/db/map.go +++ b/src/translib/db/map.go @@ -1,7 +1,21 @@ -/* -Copyright 2019 Broadcom. All rights reserved. -The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -*/ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package db implements a wrapper over the go-redis/redis. diff --git a/src/translib/db/subscribe.go b/src/translib/db/subscribe.go index 145f6fee12..65ea09811e 100644 --- a/src/translib/db/subscribe.go +++ b/src/translib/db/subscribe.go @@ -1,7 +1,21 @@ -/* -Copyright 2019 Broadcom. All rights reserved. -The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -*/ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package db implements a wrapper over the go-redis/redis. diff --git a/src/translib/db/test/arloIssue29.go b/src/translib/db/test/arloIssue29.go index 5299f4bf82..d42613d664 100644 --- a/src/translib/db/test/arloIssue29.go +++ b/src/translib/db/test/arloIssue29.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + /* UT for https://github.com/project-arlo/sonic-mgmt-framework/issues/29 diff --git a/src/translib/db/test/testdb.go b/src/translib/db/test/testdb.go index 0756bac16e..c28b368e3a 100644 --- a/src/translib/db/test/testdb.go +++ b/src/translib/db/test/testdb.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/translib/db/test/testmap.go b/src/translib/db/test/testmap.go index 7a8c76f303..728b8842ac 100644 --- a/src/translib/db/test/testmap.go +++ b/src/translib/db/test/testmap.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( diff --git a/src/translib/db/test/testsubscribe.go b/src/translib/db/test/testsubscribe.go index 751fb3c75c..298bf3443a 100644 --- a/src/translib/db/test/testsubscribe.go +++ b/src/translib/db/test/testsubscribe.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package main import ( From 99720f5d5ccdad86529a4617032b49cf508c9d3f Mon Sep 17 00:00:00 2001 From: Partha Dutta Date: Wed, 18 Sep 2019 09:37:06 +0530 Subject: [PATCH 08/13] Moving unwanted CVL YANG to testdata --- src/cvl/Makefile | 6 ++- src/cvl/cvl_test.go | 8 +-- src/cvl/internal/yparser/yparser.go | 11 +++- src/cvl/schema/sonic-acl.yang | 51 +++++-------------- src/cvl/schema/sonic-common.yang | 28 +++++----- src/cvl/schema/sonic-interface.yang | 16 +++--- src/cvl/schema/sonic-mirror-session.yang | 4 +- src/cvl/schema/sonic-port.yang | 10 ++-- src/cvl/testdata/schema/Makefile | 26 ++++++++++ .../{ => testdata}/schema/sonic-acl-dev.yang | 4 +- .../schema/sonic-bgp-neighbor.yang | 4 +- .../schema/sonic-buffer-pg.yang | 4 +- .../schema/sonic-buffer-pool.yang | 4 +- .../schema/sonic-buffer-profile.yang | 4 +- .../schema/sonic-cablelength.yang | 4 +- .../schema/sonic-device-metadata.yang | 4 +- .../schema/sonic-device-neighbor.yang | 4 +- .../schema/sonic-dscp-tc-map.yang | 4 +- .../schema/sonic-pf-limits.yang | 4 +- .../schema/sonic-pfc-priority-queue-map.yang | 4 +- .../schema/sonic-port-qos-map.yang | 4 +- .../schema/sonic-portchannel-interface.yang | 4 +- .../schema/sonic-portchannel.yang | 4 +- .../{ => testdata}/schema/sonic-queue.yang | 4 +- .../schema/sonic-scheduler.yang | 4 +- .../schema/sonic-tc-priority-group-map.yang | 4 +- .../schema/sonic-tc-queue-map.yang | 4 +- .../{ => testdata}/schema/sonic-vlan-dev.yang | 4 +- .../testdata/schema/sonic-vlan-dev.yin.tmp | 30 +++++++++++ .../schema/sonic-vlan-interface.yang | 4 +- src/cvl/{ => testdata}/schema/sonic-vlan.yang | 4 +- .../schema/sonic-wred-profile.yang | 4 +- src/cvl/tests/Makefile | 1 + 33 files changed, 162 insertions(+), 117 deletions(-) create mode 100644 src/cvl/testdata/schema/Makefile rename src/cvl/{ => testdata}/schema/sonic-acl-dev.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-bgp-neighbor.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-buffer-pg.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-buffer-pool.yang (96%) rename src/cvl/{ => testdata}/schema/sonic-buffer-profile.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-cablelength.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-device-metadata.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-device-neighbor.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-dscp-tc-map.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-pf-limits.yang (96%) rename src/cvl/{ => testdata}/schema/sonic-pfc-priority-queue-map.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-port-qos-map.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-portchannel-interface.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-portchannel.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-queue.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-scheduler.yang (96%) rename src/cvl/{ => testdata}/schema/sonic-tc-priority-group-map.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-tc-queue-map.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-vlan-dev.yang (96%) create mode 100644 src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp rename src/cvl/{ => testdata}/schema/sonic-vlan-interface.yang (97%) rename src/cvl/{ => testdata}/schema/sonic-vlan.yang (98%) rename src/cvl/{ => testdata}/schema/sonic-wred-profile.yang (98%) diff --git a/src/cvl/Makefile b/src/cvl/Makefile index 4f85259fc4..198a541290 100644 --- a/src/cvl/Makefile +++ b/src/cvl/Makefile @@ -50,7 +50,11 @@ tests: make -C tests gotest: - CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/schema GOPATH=$(GOPATH) tests/run_test.sh + make -C schema + make -C testdata/schema + cp schema/*.yin testdata/schema + #CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/schema:$(abspath .)/testdata/schema GOPATH=$(GOPATH) tests/run_test.sh + CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/schema GOPATH=$(GOPATH) tests/run_test.sh clean: make -C tests clean diff --git a/src/cvl/cvl_test.go b/src/cvl/cvl_test.go index 74d51df3d0..1ac35ed30f 100644 --- a/src/cvl/cvl_test.go +++ b/src/cvl/cvl_test.go @@ -2806,16 +2806,16 @@ func TestBadSchema(t *testing.T) { if _, err := os.Stat("/usr/sbin/schema"); os.IsNotExist(err) { //Corrupt some schema file - exec.Command("/bin/sh", "-c", "/bin/cp schema/sonic-port.yin schema/sonic-port.yin.bad" + - " && /bin/sed -i '1 a ' schema/sonic-port.yin.bad").Output() + exec.Command("/bin/sh", "-c", "/bin/cp testdata/schema/sonic-port.yin testdata/schema/sonic-port.yin.bad" + + " && /bin/sed -i '1 a ' testdata/schema/sonic-port.yin.bad").Output() //Parse bad schema file - if module, _ := yparser.ParseSchemaFile("schema/sonic-port.yin.bad.1"); module != nil { //should fail + if module, _ := yparser.ParseSchemaFile("testdata/schema/sonic-port.yin.bad"); module != nil { //should fail t.Errorf("Bad schema parsing should fail.") } //Revert to - exec.Command("/bin/sh", "-c", "/bin/rm schema/sonic-port.yin.bad").Output() + exec.Command("/bin/sh", "-c", "/bin/rm testdata/schema/sonic-port.yin.bad").Output() } else { //Corrupt some schema file exec.Command("/bin/sh", "-c", "/bin/cp /usr/sbin/schema/sonic-port.yin /usr/sbin/schema/sonic-port.yin.bad" + diff --git a/src/cvl/internal/yparser/yparser.go b/src/cvl/internal/yparser/yparser.go index d08f66c702..a654d34fc2 100644 --- a/src/cvl/internal/yparser/yparser.go +++ b/src/cvl/internal/yparser/yparser.go @@ -7,6 +7,7 @@ import ( "strings" log "github.com/golang/glog" . "cvl/internal/util" + "fmt" ) /* @@ -235,7 +236,10 @@ func ParseSchemaFile(modelFile string) (*YParserModule, YParserError) { module := C.lys_parse_path((*C.struct_ly_ctx)(ypCtx), C.CString(modelFile), C.LYS_IN_YIN) if module == nil { + fmt.Printf("\n\nFailed Parsed file .... %s\n\n", modelFile) return nil, getErrorDetails() + } else { + fmt.Printf("\n\nParsed file .... %s\n\n", modelFile) } if (strings.Contains(modelFile, "sonic-common.yin") == true) { @@ -250,7 +254,12 @@ func ParseSchemaFile(modelFile string) (*YParserModule, YParserError) { //Add child node to a parent node func(yp *YParser) AddChildNode(module *YParserModule, parent *YParserNode, name string) *YParserNode { - return (*YParserNode)(C.lyd_new((*C.struct_lyd_node)(parent), (*C.struct_lys_module)(module), C.CString(name))) + //return (*YParserNode)(C.lyd_new((*C.struct_lyd_node)(parent), (*C.struct_lys_module)(module), C.CString(name))) + ret := (*YParserNode)(C.lyd_new((*C.struct_lyd_node)(parent), (*C.struct_lys_module)(module), C.CString(name))) + if (ret == nil) { + fmt.Printf("\n\nFailed parsing .... %s\n\n", name) + } + return ret } //Add child node to a parent node diff --git a/src/cvl/schema/sonic-acl.yang b/src/cvl/schema/sonic-acl.yang index 61ed679d8d..c2a96aaccb 100644 --- a/src/cvl/schema/sonic-acl.yang +++ b/src/cvl/schema/sonic-acl.yang @@ -19,23 +19,15 @@ module sonic-acl { prefix prt; } - import sonic-portchannel { - prefix spc; - } - import sonic-mirror-session { prefix sms; } - import sonic-pf-limits { - prefix spf; - } - organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC ACL"; @@ -50,13 +42,12 @@ module sonic-acl { list ACL_TABLE { key "aclname"; - /* must "count(/prt:sonic-port/prt:PORT) > 0"; */ leaf aclname { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,71})'; - length 1..72; - } + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,71})'; + length 1..72; + } } leaf policy_desc { @@ -84,30 +75,14 @@ module sonic-acl { } leaf-list ports { - type union { - type leafref { - path "/prt:sonic-port/prt:PORT/prt:ifname"; - } - type leafref { - path "/spc:sonic-portchannel/spc:PORTCHANNEL/spc:name"; - } + type leafref { + path "/prt:sonic-port/prt:PORT/prt:ifname"; } } } list ACL_RULE { key "aclname rulename"; - scommon:pf-check "ACL_CheckAclLimits"; - - /* Limit for number of dynamic ACL rules */ - /*must "count(../ACL_RULE) > /spf:sonic-pf-limits/acl/MAX_ACL_RULES" { - error-message "Number of ACL rules reached max platform limit."; - } - must "PRIORITY > /spf:sonic-pf-limits/acl/MAX_PRIORITY" { - error-message "Invalid ACL rule priority."; - } - must "count(../ACL_TABLE) > 0 and count(/prt:sonic-port/prt:PORT) > 0"; //Temporary work-around - */ leaf aclname { type leafref { @@ -116,7 +91,7 @@ module sonic-acl { must "(/scommon:operation/scommon:operation != 'DELETE') or " + "count(current()/../../ACL_TABLE[aclname=current()]/ports) = 0" { error-message "Ports are already bound to this rule."; - } + } } leaf rulename { @@ -127,7 +102,7 @@ module sonic-acl { type uint16 { range "1..65535"{ error-message "Invalid ACL rule priority."; - } + } } } @@ -160,7 +135,7 @@ module sonic-acl { enum NON_IPV6; } } - + leaf IP_PROTOCOL { type uint8 { range "1|2|6|17|46|47|51|103|115"; @@ -171,8 +146,8 @@ module sonic-acl { type string{ pattern "(0x88CC)|(0x8100)|(0x8915)|(0x0806)|(0x0800)|(0x86DD)|(0x8847)"{ error-message "Invalid ACL Rule Ether Type"; - error-app-tag ether-type-invalid; - } + error-app-tag ether-type-invalid; + } } } diff --git a/src/cvl/schema/sonic-common.yang b/src/cvl/schema/sonic-common.yang index be94f4645a..329d40c537 100644 --- a/src/cvl/schema/sonic-common.yang +++ b/src/cvl/schema/sonic-common.yang @@ -8,10 +8,10 @@ module sonic-common { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC VLAN"; @@ -22,18 +22,18 @@ module sonic-common { } typedef tagging_mode { - type enumeration { - enum untagged; - enum tagged; - enum priority_tagged; - } + type enumeration { + enum untagged; + enum tagged; + enum priority_tagged; + } } typedef admin-status { - type enumeration { - enum up; - enum down; - } + type enumeration { + enum up; + enum down; + } } extension custom-handler { @@ -63,19 +63,19 @@ module sonic-common { extension map-list { description "If it is a map list"; - argument "value"; // + argument "value"; } extension map-leaf { description "Map leaf names"; - argument "value"; // + argument "value"; } extension pf-check { description "Platform specific validation"; - argument "handler"; // + argument "handler"; } container operation { diff --git a/src/cvl/schema/sonic-interface.yang b/src/cvl/schema/sonic-interface.yang index 1ddf94c115..540b3a16b8 100644 --- a/src/cvl/schema/sonic-interface.yang +++ b/src/cvl/schema/sonic-interface.yang @@ -7,8 +7,8 @@ module sonic-interface { } import ietf-inet-types { - prefix inet; - } + prefix inet; + } import sonic-common { prefix scommon; @@ -19,10 +19,10 @@ module sonic-interface { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC INTERFACE"; @@ -38,13 +38,13 @@ module sonic-interface { leaf portname{ type leafref { - path "/prt:sonic-port/prt:PORT/prt:ifname"; - } + path "/prt:sonic-port/prt:PORT/prt:ifname"; + } } leaf ip_prefix { - mandatory true; - type inet:ip-prefix; + mandatory true; + type inet:ip-prefix; } } diff --git a/src/cvl/schema/sonic-mirror-session.yang b/src/cvl/schema/sonic-mirror-session.yang index 36bb32cc81..1a2591cc0c 100644 --- a/src/cvl/schema/sonic-mirror-session.yang +++ b/src/cvl/schema/sonic-mirror-session.yang @@ -15,10 +15,10 @@ module sonic-mirror-session { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC MIRROR SESSION"; diff --git a/src/cvl/schema/sonic-port.yang b/src/cvl/schema/sonic-port.yang index 5e9e893a39..3d99d0534f 100644 --- a/src/cvl/schema/sonic-port.yang +++ b/src/cvl/schema/sonic-port.yang @@ -11,10 +11,10 @@ module sonic-port { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC VLAN"; @@ -33,11 +33,11 @@ module sonic-port { type string { pattern "Ethernet([1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])"{ error-message "Invalid interface name"; - error-app-tag interface-name-invalid; - } + error-app-tag interface-name-invalid; + } } } - + leaf index { type uint16; } diff --git a/src/cvl/testdata/schema/Makefile b/src/cvl/testdata/schema/Makefile new file mode 100644 index 0000000000..daf398bd65 --- /dev/null +++ b/src/cvl/testdata/schema/Makefile @@ -0,0 +1,26 @@ +src_files=$(wildcard *.yang) +out=$(patsubst %.yang, %.yin, $(src_files)) +out_ext=$(patsubst %.yang, %.tree, $(src_files)) + +all:schema + +schema: $(out) + +%.yin:%.yang + @echo "Generating $@ ..." + @devFile="`echo $< | cut -d . -f1`-dev.yang"; \ + if [ -f $$devFile ] ; then devOpt="--deviation-module $$devFile"; fi; \ + pyang -p /home/pd945169/mgmt_framework_pr/sonic-mgmt-framework/src/cvl/schema:../../schema/:../../schema/ietf/ -f yin $$devOpt $< -o $@.tmp + @xmllint --noblanks $@.tmp > $@ + @rm -rf $@.tmp + +%.tree:%.yang + @echo "Generating $@ ..." + @devFile="`echo $< | cut -d . -f1`-dev.yang"; \ + if [ -f $$devFile ] ; then devOpt="--deviation-module $$devFile"; fi; \ + pyang -p ../../schema/:../../schema/ietf/ -f tree $$devOpt $< -o $@ + +clean: + @echo "Removing files ..." + rm -rf $(out) + rm -rf $(out_ext) diff --git a/src/cvl/schema/sonic-acl-dev.yang b/src/cvl/testdata/schema/sonic-acl-dev.yang similarity index 97% rename from src/cvl/schema/sonic-acl-dev.yang rename to src/cvl/testdata/schema/sonic-acl-dev.yang index 963a88303c..9c47e0fd0b 100644 --- a/src/cvl/schema/sonic-acl-dev.yang +++ b/src/cvl/testdata/schema/sonic-acl-dev.yang @@ -21,10 +21,10 @@ module sonic-acl-dev { organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC ACLi Deviations"; diff --git a/src/cvl/schema/sonic-bgp-neighbor.yang b/src/cvl/testdata/schema/sonic-bgp-neighbor.yang similarity index 97% rename from src/cvl/schema/sonic-bgp-neighbor.yang rename to src/cvl/testdata/schema/sonic-bgp-neighbor.yang index f1cf321615..2264e5238e 100644 --- a/src/cvl/schema/sonic-bgp-neighbor.yang +++ b/src/cvl/testdata/schema/sonic-bgp-neighbor.yang @@ -19,10 +19,10 @@ module sonic-bgp-neighbor { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC BGP NEIGHBOR"; diff --git a/src/cvl/schema/sonic-buffer-pg.yang b/src/cvl/testdata/schema/sonic-buffer-pg.yang similarity index 98% rename from src/cvl/schema/sonic-buffer-pg.yang rename to src/cvl/testdata/schema/sonic-buffer-pg.yang index 96af02e24c..61b5013fed 100644 --- a/src/cvl/schema/sonic-buffer-pg.yang +++ b/src/cvl/testdata/schema/sonic-buffer-pg.yang @@ -23,10 +23,10 @@ module sonic-buffer-pg { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC BUFFER PG"; diff --git a/src/cvl/schema/sonic-buffer-pool.yang b/src/cvl/testdata/schema/sonic-buffer-pool.yang similarity index 96% rename from src/cvl/schema/sonic-buffer-pool.yang rename to src/cvl/testdata/schema/sonic-buffer-pool.yang index 2c6b6b3689..130c28287f 100644 --- a/src/cvl/schema/sonic-buffer-pool.yang +++ b/src/cvl/testdata/schema/sonic-buffer-pool.yang @@ -15,10 +15,10 @@ module sonic-buffer-pool { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC BUFFER POOL"; diff --git a/src/cvl/schema/sonic-buffer-profile.yang b/src/cvl/testdata/schema/sonic-buffer-profile.yang similarity index 97% rename from src/cvl/schema/sonic-buffer-profile.yang rename to src/cvl/testdata/schema/sonic-buffer-profile.yang index 7d4c1c3dc5..895def38c4 100644 --- a/src/cvl/schema/sonic-buffer-profile.yang +++ b/src/cvl/testdata/schema/sonic-buffer-profile.yang @@ -19,10 +19,10 @@ module sonic-buffer-profile { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC BUFFER PROFILE"; diff --git a/src/cvl/schema/sonic-cablelength.yang b/src/cvl/testdata/schema/sonic-cablelength.yang similarity index 97% rename from src/cvl/schema/sonic-cablelength.yang rename to src/cvl/testdata/schema/sonic-cablelength.yang index 3109294732..e4eeed031c 100644 --- a/src/cvl/schema/sonic-cablelength.yang +++ b/src/cvl/testdata/schema/sonic-cablelength.yang @@ -19,10 +19,10 @@ module sonic-cablelength { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC CABLELENGTH"; diff --git a/src/cvl/schema/sonic-device-metadata.yang b/src/cvl/testdata/schema/sonic-device-metadata.yang similarity index 98% rename from src/cvl/schema/sonic-device-metadata.yang rename to src/cvl/testdata/schema/sonic-device-metadata.yang index 77ef8a1731..0bd953836b 100644 --- a/src/cvl/schema/sonic-device-metadata.yang +++ b/src/cvl/testdata/schema/sonic-device-metadata.yang @@ -15,10 +15,10 @@ module sonic-device-metadata { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC DEVICE METADATA"; diff --git a/src/cvl/schema/sonic-device-neighbor.yang b/src/cvl/testdata/schema/sonic-device-neighbor.yang similarity index 98% rename from src/cvl/schema/sonic-device-neighbor.yang rename to src/cvl/testdata/schema/sonic-device-neighbor.yang index cba3eed0fc..9dc28187ef 100644 --- a/src/cvl/schema/sonic-device-neighbor.yang +++ b/src/cvl/testdata/schema/sonic-device-neighbor.yang @@ -20,10 +20,10 @@ module sonic-device-neighbor { organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC DEVICE NEIGHBOR"; diff --git a/src/cvl/schema/sonic-dscp-tc-map.yang b/src/cvl/testdata/schema/sonic-dscp-tc-map.yang similarity index 97% rename from src/cvl/schema/sonic-dscp-tc-map.yang rename to src/cvl/testdata/schema/sonic-dscp-tc-map.yang index 449310367a..481cfbece0 100644 --- a/src/cvl/schema/sonic-dscp-tc-map.yang +++ b/src/cvl/testdata/schema/sonic-dscp-tc-map.yang @@ -15,10 +15,10 @@ module sonic-dscp-tc-map { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC DSCP_TO_TC_MAP"; diff --git a/src/cvl/schema/sonic-pf-limits.yang b/src/cvl/testdata/schema/sonic-pf-limits.yang similarity index 96% rename from src/cvl/schema/sonic-pf-limits.yang rename to src/cvl/testdata/schema/sonic-pf-limits.yang index 984e649888..6b92e97dba 100644 --- a/src/cvl/schema/sonic-pf-limits.yang +++ b/src/cvl/testdata/schema/sonic-pf-limits.yang @@ -16,10 +16,10 @@ module sonic-pf-limits { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC Platform constrainst"; diff --git a/src/cvl/schema/sonic-pfc-priority-queue-map.yang b/src/cvl/testdata/schema/sonic-pfc-priority-queue-map.yang similarity index 97% rename from src/cvl/schema/sonic-pfc-priority-queue-map.yang rename to src/cvl/testdata/schema/sonic-pfc-priority-queue-map.yang index e1a08c07cb..b5c8952e6b 100644 --- a/src/cvl/schema/sonic-pfc-priority-queue-map.yang +++ b/src/cvl/testdata/schema/sonic-pfc-priority-queue-map.yang @@ -11,10 +11,10 @@ module sonic-pfc-priority-queue-map { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC MAP_PFC_PRIORITY_TO_QUEUE"; diff --git a/src/cvl/schema/sonic-port-qos-map.yang b/src/cvl/testdata/schema/sonic-port-qos-map.yang similarity index 98% rename from src/cvl/schema/sonic-port-qos-map.yang rename to src/cvl/testdata/schema/sonic-port-qos-map.yang index 04838ae775..eeb5ca0bbc 100644 --- a/src/cvl/schema/sonic-port-qos-map.yang +++ b/src/cvl/testdata/schema/sonic-port-qos-map.yang @@ -31,10 +31,10 @@ module sonic-port-qos-map { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC PORT_QOS_MAP"; diff --git a/src/cvl/schema/sonic-portchannel-interface.yang b/src/cvl/testdata/schema/sonic-portchannel-interface.yang similarity index 97% rename from src/cvl/schema/sonic-portchannel-interface.yang rename to src/cvl/testdata/schema/sonic-portchannel-interface.yang index 2bfc4cc006..305fd6ae76 100644 --- a/src/cvl/schema/sonic-portchannel-interface.yang +++ b/src/cvl/testdata/schema/sonic-portchannel-interface.yang @@ -19,10 +19,10 @@ module sonic-portchannel-interface { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC PORTCHANNEL INTERFACE"; diff --git a/src/cvl/schema/sonic-portchannel.yang b/src/cvl/testdata/schema/sonic-portchannel.yang similarity index 97% rename from src/cvl/schema/sonic-portchannel.yang rename to src/cvl/testdata/schema/sonic-portchannel.yang index 25b08d5785..4ecd3a33d6 100644 --- a/src/cvl/schema/sonic-portchannel.yang +++ b/src/cvl/testdata/schema/sonic-portchannel.yang @@ -15,10 +15,10 @@ module sonic-portchannel { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC PORTCHANNEL"; diff --git a/src/cvl/schema/sonic-queue.yang b/src/cvl/testdata/schema/sonic-queue.yang similarity index 98% rename from src/cvl/schema/sonic-queue.yang rename to src/cvl/testdata/schema/sonic-queue.yang index e3be11691b..fb55793443 100644 --- a/src/cvl/schema/sonic-queue.yang +++ b/src/cvl/testdata/schema/sonic-queue.yang @@ -23,10 +23,10 @@ module sonic-queue { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC QUEUE"; diff --git a/src/cvl/schema/sonic-scheduler.yang b/src/cvl/testdata/schema/sonic-scheduler.yang similarity index 96% rename from src/cvl/schema/sonic-scheduler.yang rename to src/cvl/testdata/schema/sonic-scheduler.yang index 0b0745185b..d1e26ab359 100644 --- a/src/cvl/schema/sonic-scheduler.yang +++ b/src/cvl/testdata/schema/sonic-scheduler.yang @@ -11,10 +11,10 @@ module sonic-scheduler { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC SCHEDULER"; diff --git a/src/cvl/schema/sonic-tc-priority-group-map.yang b/src/cvl/testdata/schema/sonic-tc-priority-group-map.yang similarity index 97% rename from src/cvl/schema/sonic-tc-priority-group-map.yang rename to src/cvl/testdata/schema/sonic-tc-priority-group-map.yang index 6f7ec329d7..253ed0f47b 100644 --- a/src/cvl/schema/sonic-tc-priority-group-map.yang +++ b/src/cvl/testdata/schema/sonic-tc-priority-group-map.yang @@ -11,10 +11,10 @@ module sonic-tc-priority-group-map { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC TC_TO_PRIORITY_GROUP_MAP"; diff --git a/src/cvl/schema/sonic-tc-queue-map.yang b/src/cvl/testdata/schema/sonic-tc-queue-map.yang similarity index 97% rename from src/cvl/schema/sonic-tc-queue-map.yang rename to src/cvl/testdata/schema/sonic-tc-queue-map.yang index a2473d3985..385b9edfac 100644 --- a/src/cvl/schema/sonic-tc-queue-map.yang +++ b/src/cvl/testdata/schema/sonic-tc-queue-map.yang @@ -11,10 +11,10 @@ module sonic-tc-queue-map { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC TC_TO_QUEUE_MAP"; diff --git a/src/cvl/schema/sonic-vlan-dev.yang b/src/cvl/testdata/schema/sonic-vlan-dev.yang similarity index 96% rename from src/cvl/schema/sonic-vlan-dev.yang rename to src/cvl/testdata/schema/sonic-vlan-dev.yang index 9ee9e6eede..dcb6531126 100644 --- a/src/cvl/schema/sonic-vlan-dev.yang +++ b/src/cvl/testdata/schema/sonic-vlan-dev.yang @@ -12,10 +12,10 @@ module sonic-vlan-dev { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC VLAN deviation file"; diff --git a/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp b/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp new file mode 100644 index 0000000000..1ccfd03006 --- /dev/null +++ b/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp @@ -0,0 +1,30 @@ + + + + + + + + + + + + + SONiC + + + SONiC + + + SONIC VLAN deviation file + + + + Initial revision. + + + diff --git a/src/cvl/schema/sonic-vlan-interface.yang b/src/cvl/testdata/schema/sonic-vlan-interface.yang similarity index 97% rename from src/cvl/schema/sonic-vlan-interface.yang rename to src/cvl/testdata/schema/sonic-vlan-interface.yang index 7f186b9ff0..86b9f8c0f3 100644 --- a/src/cvl/schema/sonic-vlan-interface.yang +++ b/src/cvl/testdata/schema/sonic-vlan-interface.yang @@ -19,10 +19,10 @@ module sonic-vlan-interface { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC VLAN INTERFACE"; diff --git a/src/cvl/schema/sonic-vlan.yang b/src/cvl/testdata/schema/sonic-vlan.yang similarity index 98% rename from src/cvl/schema/sonic-vlan.yang rename to src/cvl/testdata/schema/sonic-vlan.yang index f8c0bc1b48..5a043b5f22 100644 --- a/src/cvl/schema/sonic-vlan.yang +++ b/src/cvl/testdata/schema/sonic-vlan.yang @@ -20,10 +20,10 @@ module sonic-vlan { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC VLAN"; diff --git a/src/cvl/schema/sonic-wred-profile.yang b/src/cvl/testdata/schema/sonic-wred-profile.yang similarity index 98% rename from src/cvl/schema/sonic-wred-profile.yang rename to src/cvl/testdata/schema/sonic-wred-profile.yang index 96ddd89d64..89b9c90ef5 100644 --- a/src/cvl/schema/sonic-wred-profile.yang +++ b/src/cvl/testdata/schema/sonic-wred-profile.yang @@ -11,10 +11,10 @@ module sonic-wred-profile { } organization - "BRCM"; + "SONiC"; contact - "BRCM"; + "SONiC"; description "SONIC WRED_PROFILE"; diff --git a/src/cvl/tests/Makefile b/src/cvl/tests/Makefile index 36ddbc1a33..64b8eb1c6c 100644 --- a/src/cvl/tests/Makefile +++ b/src/cvl/tests/Makefile @@ -9,6 +9,7 @@ all:tests tests: $(OUT) %:%.go + make -C ../testdata/schema @echo "Building $@ ..." GOPATH=$(GOPATH) $(GO) build -gcflags="all=-N -l" $< From 4dd512a15fe6df14ece91a1d701d2ab228147990 Mon Sep 17 00:00:00 2001 From: Partha Dutta Date: Wed, 18 Sep 2019 10:33:20 +0530 Subject: [PATCH 09/13] Updated Makefiles --- src/cvl/Makefile | 3 +-- src/cvl/internal/yparser/yparser.go | 8 ++------ src/cvl/testdata/schema/Makefile | 5 ++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/cvl/Makefile b/src/cvl/Makefile index 198a541290..54c3980818 100644 --- a/src/cvl/Makefile +++ b/src/cvl/Makefile @@ -53,8 +53,7 @@ gotest: make -C schema make -C testdata/schema cp schema/*.yin testdata/schema - #CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/schema:$(abspath .)/testdata/schema GOPATH=$(GOPATH) tests/run_test.sh - CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/schema GOPATH=$(GOPATH) tests/run_test.sh + CVL_CFG_FILE=$(abspath .)/conf/cvl_cfg.json CVL_SCHEMA_PATH=$(abspath .)/testdata/schema GOPATH=$(GOPATH) tests/run_test.sh clean: make -C tests clean diff --git a/src/cvl/internal/yparser/yparser.go b/src/cvl/internal/yparser/yparser.go index a654d34fc2..a41a058507 100644 --- a/src/cvl/internal/yparser/yparser.go +++ b/src/cvl/internal/yparser/yparser.go @@ -7,7 +7,6 @@ import ( "strings" log "github.com/golang/glog" . "cvl/internal/util" - "fmt" ) /* @@ -236,10 +235,7 @@ func ParseSchemaFile(modelFile string) (*YParserModule, YParserError) { module := C.lys_parse_path((*C.struct_ly_ctx)(ypCtx), C.CString(modelFile), C.LYS_IN_YIN) if module == nil { - fmt.Printf("\n\nFailed Parsed file .... %s\n\n", modelFile) return nil, getErrorDetails() - } else { - fmt.Printf("\n\nParsed file .... %s\n\n", modelFile) } if (strings.Contains(modelFile, "sonic-common.yin") == true) { @@ -254,11 +250,11 @@ func ParseSchemaFile(modelFile string) (*YParserModule, YParserError) { //Add child node to a parent node func(yp *YParser) AddChildNode(module *YParserModule, parent *YParserNode, name string) *YParserNode { - //return (*YParserNode)(C.lyd_new((*C.struct_lyd_node)(parent), (*C.struct_lys_module)(module), C.CString(name))) ret := (*YParserNode)(C.lyd_new((*C.struct_lyd_node)(parent), (*C.struct_lys_module)(module), C.CString(name))) if (ret == nil) { - fmt.Printf("\n\nFailed parsing .... %s\n\n", name) + TRACE_LOG(INFO_DEBUG, TRACE_YPARSER, "Failed parsing node %s\n", name) } + return ret } diff --git a/src/cvl/testdata/schema/Makefile b/src/cvl/testdata/schema/Makefile index daf398bd65..8fabd881ed 100644 --- a/src/cvl/testdata/schema/Makefile +++ b/src/cvl/testdata/schema/Makefile @@ -10,7 +10,7 @@ schema: $(out) @echo "Generating $@ ..." @devFile="`echo $< | cut -d . -f1`-dev.yang"; \ if [ -f $$devFile ] ; then devOpt="--deviation-module $$devFile"; fi; \ - pyang -p /home/pd945169/mgmt_framework_pr/sonic-mgmt-framework/src/cvl/schema:../../schema/:../../schema/ietf/ -f yin $$devOpt $< -o $@.tmp + pyang -p ../../schema/:../../schema/ietf/ -f yin $$devOpt $< -o $@.tmp @xmllint --noblanks $@.tmp > $@ @rm -rf $@.tmp @@ -22,5 +22,4 @@ schema: $(out) clean: @echo "Removing files ..." - rm -rf $(out) - rm -rf $(out_ext) + rm -rf *.yin From a2714372ad7373ac826997c2d68b849eda1aa08e Mon Sep 17 00:00:00 2001 From: Partha Dutta Date: Wed, 18 Sep 2019 10:45:49 +0530 Subject: [PATCH 10/13] Delete file checked in mistakenly. --- .../testdata/schema/sonic-vlan-dev.yin.tmp | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp diff --git a/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp b/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp deleted file mode 100644 index 1ccfd03006..0000000000 --- a/src/cvl/testdata/schema/sonic-vlan-dev.yin.tmp +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - SONiC - - - SONiC - - - SONIC VLAN deviation file - - - - Initial revision. - - - From 692beca2ab2d5f4850ecb9ddab7c6fdeb377c5cb Mon Sep 17 00:00:00 2001 From: Partha Dutta Date: Wed, 18 Sep 2019 11:30:44 +0530 Subject: [PATCH 11/13] Updated new Makefile with license, copy schema from testdata/schema also. --- Makefile | 1 + src/cvl/schema/sonic-acl.yang | 8 ++++---- src/cvl/testdata/schema/Makefile | 19 +++++++++++++++++++ src/cvl/testdata/schema/sonic-acl-dev.yang | 2 +- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d2f9b1fe07..01d0a951db 100644 --- a/Makefile +++ b/Makefile @@ -101,6 +101,7 @@ install: $(INSTALL) -d $(DESTDIR)/usr/sbin/schema/ $(INSTALL) -d $(DESTDIR)/usr/sbin/lib/ $(INSTALL) -D $(TOPDIR)/src/cvl/schema/*.yin $(DESTDIR)/usr/sbin/schema/ + $(INSTALL) -D $(TOPDIR)/src/cvl/testdata/schema/*.yin $(DESTDIR)/usr/sbin/schema/ cp -rf $(TOPDIR)/build/rest_server/dist/ui/ $(DESTDIR)/rest_ui/ cp -rf $(TOPDIR)/build/cli $(DESTDIR)/usr/sbin/ cp -rf $(TOPDIR)/build/swagger_client_py/ $(DESTDIR)/usr/sbin/lib/ diff --git a/src/cvl/schema/sonic-acl.yang b/src/cvl/schema/sonic-acl.yang index c2a96aaccb..fc65e5ac4a 100644 --- a/src/cvl/schema/sonic-acl.yang +++ b/src/cvl/schema/sonic-acl.yang @@ -143,11 +143,11 @@ module sonic-acl { } leaf ETHER_TYPE { - type string{ - pattern "(0x88CC)|(0x8100)|(0x8915)|(0x0806)|(0x0800)|(0x86DD)|(0x8847)"{ + type string { + pattern "(0x88CC)|(0x8100)|(0x8915)|(0x0806)|(0x0800)|(0x86DD)|(0x8847)" { error-message "Invalid ACL Rule Ether Type"; - error-app-tag ether-type-invalid; - } + error-app-tag ether-type-invalid; + } } } diff --git a/src/cvl/testdata/schema/Makefile b/src/cvl/testdata/schema/Makefile index 8fabd881ed..308b3eaf6b 100644 --- a/src/cvl/testdata/schema/Makefile +++ b/src/cvl/testdata/schema/Makefile @@ -1,3 +1,22 @@ +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ + src_files=$(wildcard *.yang) out=$(patsubst %.yang, %.yin, $(src_files)) out_ext=$(patsubst %.yang, %.tree, $(src_files)) diff --git a/src/cvl/testdata/schema/sonic-acl-dev.yang b/src/cvl/testdata/schema/sonic-acl-dev.yang index 9c47e0fd0b..7fcf99f931 100644 --- a/src/cvl/testdata/schema/sonic-acl-dev.yang +++ b/src/cvl/testdata/schema/sonic-acl-dev.yang @@ -27,7 +27,7 @@ module sonic-acl-dev { "SONiC"; description - "SONIC ACLi Deviations"; + "SONIC ACL Deviations"; revision 2019-05-15 { description From 1b9a60f8ddb99b631f1c8229150cc340329daf35 Mon Sep 17 00:00:00 2001 From: Mayank Maheshwari Date: Wed, 18 Sep 2019 16:19:23 +0530 Subject: [PATCH 12/13] Updated License statement --- src/translib/ocbinds/oc.go | 19 +++++++++++++ src/translib/tlerr/app_errors.go | 24 ++++++++++++----- src/translib/tlerr/tlerr.go | 46 +++++++++++++++++++++----------- 3 files changed, 67 insertions(+), 22 deletions(-) diff --git a/src/translib/ocbinds/oc.go b/src/translib/ocbinds/oc.go index 91b532c907..2e3b833ece 100644 --- a/src/translib/ocbinds/oc.go +++ b/src/translib/ocbinds/oc.go @@ -1,3 +1,22 @@ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// + package ocbinds //go:generate sh -c "/usr/local/go/bin/go run $BUILD_GOPATH/src/github.com/openconfig/ygot/generator/generator.go -generate_fakeroot -output_file ocbinds.go -package_name ocbinds -generate_fakeroot -fakeroot_name=device -compress_paths=false -exclude_modules ietf-interfaces -path . $(find ../../../models/yang -name '*.yang' | sort)" diff --git a/src/translib/tlerr/app_errors.go b/src/translib/tlerr/app_errors.go index dec7b03184..d695954326 100644 --- a/src/translib/tlerr/app_errors.go +++ b/src/translib/tlerr/app_errors.go @@ -1,9 +1,21 @@ -/////////////////////////////////////////////////////////////////////// -// -// Copyright 2019 Broadcom. All rights reserved. -// The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -// -/////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// package tlerr diff --git a/src/translib/tlerr/tlerr.go b/src/translib/tlerr/tlerr.go index a0c799b386..8ff1254301 100644 --- a/src/translib/tlerr/tlerr.go +++ b/src/translib/tlerr/tlerr.go @@ -1,7 +1,21 @@ -/* -Copyright 2019 Broadcom. All rights reserved. -The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. -*/ +//////////////////////////////////////////////////////////////////////////////// +// // +// Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or // +// its subsidiaries. // +// // +// Licensed under the Apache License, Version 2.0 (the "License"); // +// you may not use this file except in compliance with the License. // +// You may obtain a copy of the License at // +// // +// http://www.apache.org/licenses/LICENSE-2.0 // +// // +// Unless required by applicable law or agreed to in writing, software // +// distributed under the License is distributed on an "AS IS" BASIS, // +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // +// See the License for the specific language governing permissions and // +// limitations under the License. // +// // +//////////////////////////////////////////////////////////////////////////////// /* Package tlerr defines the errors of the translib library. @@ -17,15 +31,15 @@ Hence, it cannot occur here. package tlerr import ( -// "fmt" - "golang.org/x/text/message" - "golang.org/x/text/language" + // "fmt" "cvl" -// "errors" -// "strings" + "golang.org/x/text/language" + "golang.org/x/text/message" + // "errors" + // "strings" ) -var p * message.Printer +var p *message.Printer func init() { p = message.NewPrinter(language.English) @@ -48,7 +62,7 @@ func (e TranslibDBNotInit) Error() string { } type TranslibRedisClientEntryNotExist struct { - Entry string + Entry string } func (e TranslibRedisClientEntryNotExist) Error() string { @@ -56,8 +70,8 @@ func (e TranslibRedisClientEntryNotExist) Error() string { } type TranslibCVLFailure struct { - Code int - CVLErrorInfo cvl.CVLErrorInfo + Code int + CVLErrorInfo cvl.CVLErrorInfo } func (e TranslibCVLFailure) Error() string { @@ -80,10 +94,10 @@ func (e TranslibDBSubscribeFail) Error() string { } type TranslibSyntaxValidationError struct { - StatusCode int // status code - ErrorStr error // error message + StatusCode int // status code + ErrorStr error // error message } func (e TranslibSyntaxValidationError) Error() string { - return p.Sprintf("%s", e.ErrorStr) + return p.Sprintf("%s", e.ErrorStr) } From 009158010bb2a67f407e824bbac97780703c9f33 Mon Sep 17 00:00:00 2001 From: Mayank Maheshwari Date: Wed, 18 Sep 2019 16:38:03 +0530 Subject: [PATCH 13/13] Update License statement --- go_server.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/go_server.sh b/go_server.sh index de3be2c253..4c13c1aa2f 100755 --- a/go_server.sh +++ b/go_server.sh @@ -1,5 +1,24 @@ #!/usr/bin/env bash +################################################################################ +# # +# Copyright 2019 Broadcom. The term Broadcom refers to Broadcom Inc. and/or # +# its subsidiaries. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +# # +################################################################################ + set -e TOPDIR=$PWD