Skip to content

Commit

Permalink
Merge pull request #161 from project-arlo/master
Browse files Browse the repository at this point in the history
Syncing project-arlo/sonic-mgmt-framework master to brcm_poc
  • Loading branch information
a-barboza authored Oct 10, 2019
2 parents 27a8fa8 + 8e2bae3 commit d2760ef
Show file tree
Hide file tree
Showing 190 changed files with 13,135 additions and 2,096 deletions.
43 changes: 36 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -63,6 +75,8 @@ cli: rest-server
cvl: go-deps
$(MAKE) -C src/cvl
$(MAKE) -C src/cvl/schema
$(MAKE) -C src/cvl/testdata/schema

cvl-test:
$(MAKE) -C src/cvl gotest

Expand All @@ -80,6 +94,7 @@ codegen:

yamlGen:
$(MAKE) -C models/yang
$(MAKE) -C models/yang/sonic

go-patch: go-deps
cd $(BUILD_GOPATH)/src/github.com/openconfig/ygot/; git reset --hard HEAD; git checkout 724a6b18a9224343ef04fe49199dfb6020ce132a 2>/dev/null ; true; \
Expand All @@ -93,14 +108,28 @@ cp $(TOPDIR)/ygot-modified-files/schema.go $(BUILD_GOPATH)/src/github.com/openco
cp $(TOPDIR)/ygot-modified-files/unmarshal.go $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ytypes/unmarshal.go; \
cp $(TOPDIR)/ygot-modified-files/validate.go $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ytypes/validate.go; \
cp $(TOPDIR)/ygot-modified-files/reflect.go $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ytypes/../util/reflect.go; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ygot
cp $(TOPDIR)/goyang-modified-files/README.md $(BUILD_GOPATH)/src/github.com/openconfig/goyang/README.md; \
cp $(TOPDIR)/goyang-modified-files/yang.go $(BUILD_GOPATH)/src/github.com/openconfig/goyang/yang.go; \
cp $(TOPDIR)/goyang-modified-files/annotate.go $(BUILD_GOPATH)/src/github.com/openconfig/goyang/annotate.go; \
cp $(TOPDIR)/goyang-modified-files/entry.go $(BUILD_GOPATH)/src/github.com/openconfig/goyang/pkg/yang/entry.go; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ygot; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/goyang

install:
$(INSTALL) -D $(REST_BIN) $(DESTDIR)/usr/sbin/rest_server
$(INSTALL) -D $(CERTGEN_BIN) $(DESTDIR)/usr/sbin/generate_cert
$(INSTALL) -d $(DESTDIR)/usr/sbin/schema/
$(INSTALL) -d $(DESTDIR)/usr/sbin/lib/
$(INSTALL) -d $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/models/yang/sonic/*.yang $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/models/yang/sonic/common/*.yang $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/src/cvl/schema/*.yin $(DESTDIR)/usr/sbin/schema/
$(INSTALL) -D $(TOPDIR)/src/cvl/testdata/schema/*.yin $(DESTDIR)/usr/sbin/schema/
$(INSTALL) -D $(TOPDIR)/src/cvl/schema/*.yang $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/models/yang/*.yang $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/config/transformer/models_list $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/models/yang/common/*.yang $(DESTDIR)/usr/models/yang/
$(INSTALL) -D $(TOPDIR)/models/yang/annotations/*.yang $(DESTDIR)/usr/models/yang/
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/
Expand Down
4 changes: 4 additions & 0 deletions config/transformer/models_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#List yang models transformer need to load

openconfig-acl.yang
openconfig-acl-annot.yang
19 changes: 19 additions & 0 deletions go_server.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
50 changes: 50 additions & 0 deletions goyang-modified-files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# goyang
YANG parser and compiler for Go programs.

The yang package (pkg/yang) is used to convert a YANG schema into either an
in memory abstract syntax trees (ast) or more fully resolved, in memory, "Entry"
trees. An Entry tree consists only of Entry structures and has had
augmentation, imports, and includes all applied.

goyang is a sample program that uses the yang (pkg/yang) package.

goyang uses the yang package to create an in-memory tree representation of
schemas defined in YANG and then dumps out the contents in several forms.
The forms include:

* tree - a simple tree representation
* types - list understood types extracted from the schema
* annotate - a template file to annotate the yang modules

The yang package, and the goyang program, are not complete and are a work in
progress.

For more complex output types, such as Go structs, and protobuf messages
please use the [openconfig/ygot](https://github.com/openconfig/ygot) package,
which uses this package as its backend.

### Getting started

To build goyang, ensure you have go language tools installed
(available at [golang.org](https://golang.org/dl)) and that the `GOPATH`
environment variable is set to your Go workspace.

1. `go get github.com/openconfig/goyang`
* This will download goyang code and dependencies into the src
subdirectory in your workspace.

2. `cd <workspace>/src/github.com/openconfig/goyang`

3. `go build`

* This will build the goyang binary and place it in the bin
subdirectory in your workspace.

### Contributing to goyang

goyang is still a work-in-progress and we welcome contributions. Please see
the `CONTRIBUTING` file for information about how to contribute to the codebase.

### Disclaimer

This is not an official Google product.
Loading

0 comments on commit d2760ef

Please sign in to comment.