Skip to content

Commit

Permalink
Merge pull request #171 from project-arlo/brcm_poc
Browse files Browse the repository at this point in the history
Brcm poc
  • Loading branch information
dutta-partha authored Oct 14, 2019
2 parents eb9f924 + 0fd0ed4 commit b234074
Show file tree
Hide file tree
Showing 35 changed files with 5,186 additions and 480 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ GO_DEPS_LIST = github.com/gorilla/mux \
github.com/pkg/profile \
gopkg.in/go-playground/validator.v9 \
golang.org/x/crypto/ssh \
github.com/antchfx/jsonquery \
github.com/antchfx/xmlquery \
github.com/philopon/go-toposort
github.com/antchfx/jsonquery \
github.com/antchfx/xmlquery \
github.com/facette/natsort \
github.com/philopon/go-toposort


REST_BIN = $(BUILD_DIR)/rest_server/main
Expand All @@ -73,7 +74,7 @@ $(GO_DEPS_LIST):
cli: rest-server
$(MAKE) -C src/CLI

cvl: go-deps
cvl: go-deps go-patch go-redis-patch
$(MAKE) -C src/cvl
$(MAKE) -C src/cvl/schema
$(MAKE) -C src/cvl/testdata/schema
Expand Down Expand Up @@ -109,12 +110,13 @@ 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; \
cp $(TOPDIR)/ygot-modified-files/string_type.go $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ytypes/string_type.go; \
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
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/goyang; \
$(GO) install -v -gcflags "-N -l" $(BUILD_GOPATH)/src/github.com/openconfig/ygot/ygot

install:
$(INSTALL) -D $(REST_BIN) $(DESTDIR)/usr/sbin/rest_server
Expand Down
8 changes: 6 additions & 2 deletions goyang-modified-files/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ type Entry struct {
// the augmenting entity per RFC6020 Section 7.15.2. The namespace
// of the Entry should be accessed using the Namespace function.
namespace *Value

ChildSchemaCache map[reflect.StructTag]*Entry `json:"-"`

IsSchemaValidated bool `json:"-"`
}

// An RPCEntry contains information related to an RPC Node.
Expand Down Expand Up @@ -1399,8 +1403,8 @@ func (s sortedErrors) Less(i, j int) bool {
}
return nless(fi[x], fj[x])
}
for x := 1; x < 4; x++ {
switch compare(1) {
for x := 0; x < len(fi) && x < len(fj); x++ {
switch compare(x) {
case -1:
return true
case 1:
Expand Down
18 changes: 10 additions & 8 deletions models/yang/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
TOPDIR := ../..
BUILD_DIR := $(TOPDIR)/build

YANGAPI_DIR := $(TOPDIR)/build/yaml
YANGDIR := $(TOPDIR)/models/yang
YANGDIR_COMMON := $(TOPDIR)/models/yang/common
YANG_MOD_FILES := $(shell find $(YANGDIR) -maxdepth 1 -name '*.yang' | sort)
YANG_COMMON_FILES := $(shell find $(YANGDIR_COMMON) -name '*.yang' | sort)
YANGAPI_DIR := $(TOPDIR)/build/yaml
YANGDIR := $(TOPDIR)/models/yang
YANGDIR_COMMON := $(TOPDIR)/models/yang/common
YANGDIR_ANNOTATIONS := $(TOPDIR)/models/yang/annotations/openapi_annotations
YANG_MOD_FILES := $(shell find $(YANGDIR) -maxdepth 1 -name '*.yang' | sort)
YANG_ANNOTATIONS_FILES := $(shell find $(YANGDIR_ANNOTATIONS) -maxdepth 1 -name '*.yang' | sort)
YANG_COMMON_FILES := $(shell find $(YANGDIR_COMMON) -name '*.yang' | sort)

TOOLS_DIR := $(TOPDIR)/tools
PYANG_DIR := $(TOOLS_DIR)/pyang
Expand All @@ -42,15 +44,15 @@ allyangs.tree: $(YANG_MOD_FILES) $(YANG_COMMON_FILES)
-f tree \
-o $(YANGDIR)/$@ \
-p $(YANGDIR_COMMON):$(YANGDIR) \
$(YANG_MOD_FILES)
$(YANG_MOD_FILES) $(YANG_ANNOTATIONS_FILES)
@echo "+++++ Generation of YANG tree for Yang modules completed +++++"

allyangs_tree.html: $(YANG_MOD_FILES) $(YANG_COMMON_FILES)
$(PYANG_BIN) \
-f jstree \
-o $(YANGDIR)/$@ \
-p $(YANGDIR_COMMON):$(YANGDIR) \
$(YANG_MOD_FILES)
$(YANG_MOD_FILES) $(YANG_ANNOTATIONS_FILES)
@echo "+++++ Generation of HTML tree for Yang modules completed +++++"

#======================================================================
Expand All @@ -64,7 +66,7 @@ $(YANGAPI_DIR)/.done: $(YANG_MOD_FILES) $(YANG_COMMON_FILES)
--outdir $(YANGAPI_DIR) \
--plugindir $(PYANG_PLUGIN_DIR) \
-p $(YANGDIR_COMMON):$(YANGDIR) \
$(YANG_MOD_FILES)
$(YANG_MOD_FILES) $(YANG_ANNOTATIONS_FILES)
@echo "+++++ Generation of YAML files for Yang modules completed +++++"
touch $@

Expand Down
243 changes: 243 additions & 0 deletions models/yang/common/openconfig-spanning-tree-types.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
module openconfig-spanning-tree-types {

yang-version "1";

// namespace
namespace "http://openconfig.net/yang/spanning-tree/types";

prefix "oc-stp-types";

// import some basic types
import openconfig-extensions { prefix oc-ext; }


// meta
organization "OpenConfig working group";

contact
"OpenConfig working group
www.openconfig.net";

description
"This module defines types related to the
spanning-tree protocol model.";

oc-ext:openconfig-version "0.3.0";

revision "2014-03-14" {
description
"Remove the time-since-last-topology-change leaf and
replace it with a timestamp of last topology change.";
reference "0.3.0";
}

revision "2018-11-21" {
description
"Add OpenConfig module metadata extensions.";
reference "0.2.1";
}

revision "2017-07-14" {
description
"Migrated to OpenConfig types; fixed missing applied state
in rapid-pvst";
reference "0.2.0";
}

revision "2016-10-03" {
description
"Initial public revision";
reference "0.1.0";
}

// OpenConfig specific extensions for module metadata.
oc-ext:regexp-posix;
oc-ext:catalog-organization "openconfig";
oc-ext:origin "openconfig";

// identity statements

identity STP_PROTOCOL {
description
"base identity for support spanning tree protocol";
}

identity RSTP {
base STP_PROTOCOL;
description
"Rapid Spanning Tree Protocol";
reference "IEEE 802.1D 17";
}

identity MSTP {
base STP_PROTOCOL;
description
"Multiple Spanning Tree Protocol";
reference "IEEE 802.1Q 13";
}

identity RAPID_PVST {
base STP_PROTOCOL;
description
"Rapid Per Vlan Spanning Tree Protocol";
}

identity STP_PORT_STATE {
description
"base identity for the different Spanning Tree Protocol port
states";
reference
"IEEE 802.1D 7.4 Port States and the active topology";
}

identity DISABLED {
base STP_PORT_STATE;
description
"A port that is manually isolated from the network";
}

identity LISTENING {
base STP_PORT_STATE;
description
"Processing BPDUs and building active toplogy";
}

identity LEARNING {
base STP_PORT_STATE;
description
"Building bridging tables; no forwarding of data";
}

identity BLOCKING {
base STP_PORT_STATE;
description
"A port that would cause a loop if it were sending data,
so it is only receiving BPDUs, untill a topology change
removes the possibliity of a loop";
}

identity FORWARDING {
base STP_PORT_STATE;
description
"Sending and receiving data, normal operation";
}

identity STP_EDGE_PORT {
description
"base identity for the different edge port modes";
reference
"IEEE 802.1D 17.13.1";
}

identity EDGE_ENABLE {
base STP_EDGE_PORT;
description
"Enable edge port for the bridge port";
}

identity EDGE_DISABLE {
base STP_EDGE_PORT;
description
"Disable edge port for the bridge port";
}

identity EDGE_AUTO {
base STP_EDGE_PORT;
description
"Enable edge port autodetction for the bridge port";
}

identity STP_PORT_ROLE {
description
"Base identity for the different Spanning Tree Protocol port
roles";
reference
"IEEE 802.1D 17.7 Port Role assignments";
}

identity ROOT {
base STP_PORT_ROLE;
description
"The port that receives the best BPDU on a bridge is the
root port";
}

identity DESIGNATED {
base STP_PORT_ROLE;
description
"A port is designated if it can send the best BPDU on the
segment to which it is connected.";
}

identity ALTERNATE {
base STP_PORT_ROLE;
description
"An alternate port receives more useful BPDUs from another
bridge and is a port blocked";
}

identity BACKUP {
base STP_PORT_ROLE;
description
"A backup port receives more useful BPDUs from the same
bridge it is on and is a port blocked";
}

// typedef statements

typedef stp-bridge-priority-type {
type uint32 {
range 1..611440;
}
description
"The manageable component of the Bridge Identifier";
reference "IEEE 802.1D 17.13.7 Bridge Identifier Priority";
}

typedef stp-port-priority-type {
type uint8 {
range 1..240;
}
description
"The manageable component of the Port Identifier,
also known as the Port Priority";
reference
"IEEE 802.1D 17.13.10 Port Identifier Priority";
}

typedef stp-guard-type {
type enumeration {
enum ROOT {
description
"Enable root guard";
}
enum LOOP {
description
"Enable loop guard";
}
enum NONE {
description
"disable guard";
}
}
description
"Type definition for the different STP guard for the switch port";
reference "IEEE 802.1D 17.2";
}

typedef stp-link-type {
type enumeration {
enum P2P {
description
"Point-to-Point link";
}
enum SHARED {
description
"Shared link";
}
}
description
"Type definition for the different link types";
reference "IEEE 802.1D 17.2";
}
}
5 changes: 5 additions & 0 deletions models/yang/common/sonic-extensions.yang
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ module sonic-extensions {
description "Db table field name.";
}

extension openapi-opid {
argument "openapi-opid";
description "Custom Operation ID for OpenAPI";
}

extension field-transformer {
argument "field-transformer-name";
description "Db table field transformer name.This can be applied to either transform yang value to some different format
Expand Down
Loading

0 comments on commit b234074

Please sign in to comment.