forked from sonic-net/sonic-mgmt-framework
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from project-arlo/sonic_yang_changes_1.0
SONiC YANG changes for rel_1.0
- Loading branch information
Showing
42 changed files
with
1,402 additions
and
1,116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
TOPDIR := ../../../ | ||
SONIC_YANGAPI_DIR := $(TOPDIR)/build/yaml | ||
SONIC_YANGDIR := $(TOPDIR)/models/yang/sonic | ||
SONIC_YANGDIR_DEVIATION := $(TOPDIR)/models/yang/sonic/deviation | ||
SONIC_YANGDIR_COMMON := $(TOPDIR)/models/yang/sonic/common | ||
SONIC_YANGDIR_COMMON_IETF := $(TOPDIR)/models/yang/sonic/common/ietf | ||
SONIC_YANG_MOD_FILES := $(shell find $(SONIC_YANGDIR) -maxdepth 1 -name '*.yang' | sort) | ||
SONIC_YANG_COMMON_FILES := $(shell find $(SONIC_YANGDIR_COMMON) -name '*.yang' | sort) | ||
SONIC_YANG_COMMON_FILES += $(shell find $(SONIC_YANGDIR_COMMON_IETF) -name '*.yang' | sort) | ||
|
||
SONIC_TOOLS_DIR := $(TOPDIR)/tools | ||
SONIC_PYANG_DIR := $(SONIC_TOOLS_DIR)/pyang | ||
SONIC_PYANG_PLUGIN_DIR := $(SONIC_PYANG_DIR)/pyang_plugins | ||
SONIC_PYANG_BIN := pyang | ||
|
||
all: yamlGen allyangs.tree allyangs_tree.html | ||
|
||
#yamlGen: $(SONIC_YANGAPI_DIR)/.done | ||
|
||
allyangs.tree: $(SONIC_YANG_MOD_FILES) $(SONIC_YANG_COMMON_FILES) | ||
$(SONIC_PYANG_BIN) \ | ||
-f tree \ | ||
-o $(SONIC_YANGDIR)/$@ \ | ||
-p $(SONIC_YANGDIR_COMMON):$(SONIC_YANGDIR) \ | ||
$(SONIC_YANG_MOD_FILES) | ||
@echo "+++++ Generation of YANG tree for Sonic Yang modules completed +++++" | ||
|
||
allyangs_tree.html: $(SONIC_YANG_MOD_FILES) $(SONIC_YANG_COMMON_FILES) | ||
$(SONIC_PYANG_BIN) \ | ||
-f jstree \ | ||
-o $(SONIC_YANGDIR)/$@ \ | ||
-p $(SONIC_YANGDIR_COMMON):$(SONIC_YANGDIR) \ | ||
$(SONIC_YANG_MOD_FILES) | ||
@echo "+++++ Generation of HTML tree for Sonic Yang modules completed +++++" | ||
|
||
#====================================================================== | ||
# Generate YAML files for SONiC YANG modules | ||
#====================================================================== | ||
yamlGen: | ||
@echo "+++++ Generating YAML files for Sonic Yang modules +++++" | ||
mkdir -p $(SONIC_YANGAPI_DIR) | ||
$(SONIC_PYANG_BIN) \ | ||
-f swaggerapi \ | ||
--outdir $(SONIC_YANGAPI_DIR) \ | ||
--plugindir $(SONIC_PYANG_PLUGIN_DIR) \ | ||
-p $(SONIC_YANGDIR_COMMON):$(SONIC_YANGDIR) \ | ||
$(SONIC_YANG_MOD_FILES) | ||
@echo "+++++ Generation of YAML files for Sonic Yang modules completed +++++" | ||
|
||
clean: | ||
@echo "Removing files ..." | ||
rm -rf $(SONIC_YANGAPI_DIR) | ||
rm -rf allyangs.tree allyangs_tree.html |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
module sonic-common { | ||
namespace "http://github.com/Azure/sonic-common"; | ||
prefix scommon; | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONIC VLAN"; | ||
|
||
revision 2019-05-15 { | ||
description | ||
"Initial revision."; | ||
} | ||
|
||
typedef tagging_mode { | ||
type enumeration { | ||
enum untagged; | ||
enum tagged; | ||
enum priority_tagged; | ||
} | ||
} | ||
|
||
typedef admin-status { | ||
type enumeration { | ||
enum up; | ||
enum down; | ||
} | ||
} | ||
|
||
|
||
container operation { | ||
leaf operation { | ||
type string; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
module sonic-acl { | ||
namespace "http://github.com/Azure/sonic-acl"; | ||
prefix sacl; | ||
yang-version 1.1; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-common { | ||
prefix cmn; | ||
} | ||
|
||
import sonic-port { | ||
prefix prt; | ||
} | ||
|
||
import sonic-mirror-session { | ||
prefix sms; | ||
} | ||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONIC ACL"; | ||
|
||
revision 2019-05-15 { | ||
description | ||
"Initial revision."; | ||
} | ||
|
||
container sonic-acl { | ||
|
||
container ACL_TABLE { | ||
|
||
list ACL_TABLE_LIST { | ||
key "aclname"; | ||
|
||
leaf aclname { | ||
type string { | ||
pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,71})'; | ||
length 1..72; | ||
} | ||
} | ||
|
||
leaf policy_desc { | ||
type string { | ||
length 1..255 { | ||
error-app-tag policy-desc-invalid-length; | ||
} | ||
} | ||
} | ||
|
||
leaf stage { | ||
type enumeration { | ||
enum INGRESS; | ||
enum EGRESS; | ||
} | ||
} | ||
|
||
leaf type { | ||
type enumeration { | ||
enum MIRROR; | ||
enum L2; | ||
enum L3; | ||
enum L3V6; | ||
} | ||
} | ||
|
||
leaf-list ports { | ||
type leafref { | ||
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
container ACL_RULE { | ||
|
||
list ACL_RULE_LIST { | ||
key "aclname rulename"; | ||
|
||
leaf aclname { | ||
type leafref { | ||
path "../../../ACL_TABLE/ACL_TABLE_LIST/aclname"; | ||
} | ||
must "(/cmn:operation/cmn:operation != 'DELETE') or " + | ||
"count(current()/../../../ACL_TABLE/ACL_TABLE_LIST[aclname=current()]/ports) = 0" { | ||
error-message "Ports are already bound to this rule."; | ||
} | ||
} | ||
|
||
leaf rulename { | ||
type string; | ||
} | ||
|
||
leaf PRIORITY { | ||
type uint16 { | ||
range "1..65535"{ | ||
error-message "Invalid ACL rule priority."; | ||
} | ||
} | ||
} | ||
|
||
leaf RULE_DESCRIPTION { | ||
type string; | ||
} | ||
|
||
leaf PACKET_ACTION { | ||
type enumeration { | ||
enum FORWARD; | ||
enum DROP; | ||
enum REDIRECT; | ||
} | ||
} | ||
|
||
leaf MIRROR_ACTION { | ||
type leafref { | ||
path "/sms:sonic-mirror-session/sms:MIRROR_SESSION/sms:MIRROR_SESSION_LIST/sms:name"; | ||
} | ||
} | ||
|
||
leaf IP_TYPE { | ||
type enumeration { | ||
enum ANY; | ||
enum IP; | ||
enum IPV4; | ||
enum IPV4ANY; | ||
enum NON_IPV4; | ||
enum IPV6ANY; | ||
enum NON_IPV6; | ||
} | ||
} | ||
|
||
leaf IP_PROTOCOL { | ||
type uint8 { | ||
range "1|2|6|17|46|47|51|103|115"; | ||
} | ||
} | ||
|
||
leaf ETHER_TYPE { | ||
type string { | ||
pattern "(0x88CC)|(0x8100)|(0x8915)|(0x0806)|(0x0800)|(0x86DD)|(0x8847)" { | ||
error-message "Invalid ACL Rule Ether Type"; | ||
error-app-tag ether-type-invalid; | ||
} | ||
} | ||
} | ||
|
||
choice ip_src_dst { | ||
case ipv4_src_dst { | ||
//when "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV4' or .='IPV4ANY'])"; | ||
leaf SRC_IP { | ||
mandatory true; | ||
type inet:ipv4-prefix; | ||
} | ||
leaf DST_IP { | ||
mandatory true; | ||
type inet:ipv4-prefix; | ||
} | ||
} | ||
case ipv6_src_dst { | ||
//when "boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPV6ANY'])"; | ||
leaf SRC_IPV6 { | ||
mandatory true; | ||
type inet:ipv6-prefix; | ||
} | ||
leaf DST_IPV6 { | ||
mandatory true; | ||
type inet:ipv6-prefix; | ||
} | ||
} | ||
} | ||
|
||
choice src_port { | ||
case l4_src_port { | ||
leaf L4_SRC_PORT { | ||
type uint16; | ||
} | ||
} | ||
case l4_src_port_range { | ||
leaf L4_SRC_PORT_RANGE { | ||
type string { | ||
pattern "[0-9]{1,5}(-)[0-9]{1,5}"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
choice dst_port { | ||
case l4_dst_port { | ||
leaf L4_DST_PORT { | ||
type uint16; | ||
} | ||
} | ||
case l4_dst_port_range { | ||
leaf L4_DST_PORT_RANGE { | ||
type string { | ||
pattern "[0-9]{1,5}(-)[0-9]{1,5}"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
leaf TCP_FLAGS { | ||
type string { | ||
pattern "0[xX][0-9a-fA-F]{2}[/]0[xX][0-9a-fA-F]{2}"; | ||
} | ||
} | ||
|
||
leaf DSCP { | ||
type uint8; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.