Skip to content

Commit

Permalink
Merge pull request #158 from project-arlo/transformer-phase2
Browse files Browse the repository at this point in the history
Merge transformer phase 2 to arlo master
  • Loading branch information
kwangsuk authored Oct 10, 2019
2 parents d9402d2 + 032de57 commit 8e2bae3
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 95 deletions.
2 changes: 1 addition & 1 deletion models/yang/common/sonic-extensions.yang
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module sonic-extensions {
description "Validation callpoint used to validate a YANG node during data translation back to YANG as a response to GET.";
}

extension redis-db-name {
extension db-name {
argument "db-name";
description "DB name that will indicate where data is stored. Eg: Config DB, App DB etc";
}
Expand Down
18 changes: 18 additions & 0 deletions src/translib/common_app.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 (
Expand Down
24 changes: 21 additions & 3 deletions src/translib/transformer/transformer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 transformer

import (
Expand Down Expand Up @@ -30,8 +48,8 @@ func reportIfError(errs []error) {
}
}

func getOcModelsList () ([] string) {
var fileList [] string
func getOcModelsList () ([]string) {
var fileList []string
file, err := os.Open(YangPath + "models_list")
if err != nil {
return fileList
Expand All @@ -51,7 +69,7 @@ func getOcModelsList () ([] string) {
return fileList
}

func getDefaultModelsList () ([] string) {
func getDefaultModelsList () ([]string) {
var files []string
fileInfo, err := ioutil.ReadDir(YangPath)
if err != nil {
Expand Down
20 changes: 19 additions & 1 deletion src/translib/transformer/xconst.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 transformer

const (
Expand All @@ -7,7 +25,7 @@ const (
YANG_LEAF = "leaf"
YANG_LEAF_LIST = "leaflist"

YANG_ANNOT_DB_NAME = "redis-db-name"
YANG_ANNOT_DB_NAME = "db-name"
YANG_ANNOT_TABLE_NAME = "table-name"
YANG_ANNOT_FIELD_NAME = "field-name"
YANG_ANNOT_KEY_DELIM = "key-delimiter"
Expand Down
18 changes: 18 additions & 0 deletions src/translib/transformer/xfmr_acl.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 transformer

import (
Expand Down
18 changes: 18 additions & 0 deletions src/translib/transformer/xfmr_interface.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 transformer

import (
Expand Down
20 changes: 19 additions & 1 deletion src/translib/transformer/xlate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
////////////////////////////////////////////////////////////////////////////////
// //
// Copyright 2019 Dell, Inc. //
// //
// 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 transformer

import (
Expand Down Expand Up @@ -331,7 +349,7 @@ func XlateFromDb(uri string, ygRoot *ygot.GoStruct, dbs [db.MaxDB]*db.DB, data m
}
}
} else {
xpath, _ := RemoveXPATHPredicates(uri)
xpath, _ := XfmrRemoveXPATHPredicates(uri)
if _, ok := xYangSpecMap[xpath]; ok {
cdb = xYangSpecMap[xpath].dbIndex
}
Expand Down
Loading

0 comments on commit 8e2bae3

Please sign in to comment.