Skip to content

Commit

Permalink
sFlow CLI Template (#147)
Browse files Browse the repository at this point in the history
* sFlow CLI template

* Add XML skeleton for the sFlow CLI
* Add actioner script
* Add renderer template

Signed-off-by: Garrick He <[email protected]>

Rearranging Interface app module code.

Working code for creating vlan, adding tagged/untagged port to vlan, and deletion of vlan.

Refactoring intf_app.go to accomodate all the interface types.wq

Support for access-vlan delete, working vlan create, tagged/untagged
add, access/trunk mode config alone and removal of untagged.

CLI and python binding completion with testing and untagged vlan config validation.

Tested and working code for all the VLAN test cases except tagged VLAN delete, with validations added.x

Fixed the build failure.

Correcting the valid error message to be thrown to front-end.

Rearranging the get code, cleanup and add the support for vlan-info.

Tested the vlan-list get support for all the interfaces and specific
interface

Working code for get-support for individual attributes.

Working code for config, add/remove member-ports, and get support.

Cleanup of the comments and logs.

Cleanup of the code.

Added the copyright header for new files.

Support for ignoring request for same config and for meaningful error
for tagged/untagged configs to front-end.

Support for CLI support-VLAN after merging with cleaned up CLI skeleton changes.

Support for #show vlan [<id>] command using sonic-yang.

Support for deletion of trunk-vlan instance, its associated CLI support and bug fix in #show vlan command.

Cleanup of the yang files in models/yang directory and cvl directory

Bugfixes for individual get and panic warnings.

Support for state container attribute get for VLAN

Added a note for initializing DS at the beginning.
  • Loading branch information
GarrickHe authored and joyas-joseph committed Oct 8, 2019
1 parent 1043f56 commit 28351cd
Show file tree
Hide file tree
Showing 25 changed files with 3,525 additions and 284 deletions.
23 changes: 23 additions & 0 deletions models/yang/annotations/sonic-vlan-annot.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module sonic-vlan-annot {

yang-version "1.1";

namespace "http://openconfig.net/yang/annotation";
prefix "svlan-annot";

import sonic-vlan { prefix svlan; }


deviation /svlan:sonic-vlan-state/svlan:VLAN_TABLE {
deviate add {
sonic-ext:db-name "APPL_DB";
}
}

deviation /svlan:sonic-vlan-state/svlan:VLAN_MEMBER_TABLE {
deviate add {
sonic-ext:db-name "APPL_DB";
}
}
}

92 changes: 92 additions & 0 deletions models/yang/common/sonic-common.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module sonic-common {
namespace "http://github.com/Azure/sonic-common";
prefix sv;

import ietf-yang-types {
prefix yang;
}

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;
}
}

typedef oper-status {
type enumeration {
enum up;
enum down;
}
}

extension custom-handler {
description
"Node should be handled by custom handler";
argument "name";
}

extension db-name {
description
"DB name, e.g. APPL_DB, CONFIG_DB";
argument "value";
}

extension key-delim {
description
"Key delimeter, e.g. - |, :";
argument "value";
}

extension key-pattern {
description
"Key pattern, e.g. - ACL_RULE|{aclname}|{rulename}";
argument "value";
}

extension map-list {
description
"If it is a map list";
argument "value";
}

extension map-leaf {
description
"Map leaf names";
argument "value";
}

extension pf-check {
description
"Platform specific validation";
argument "handler";
}

container operation {
leaf operation {
type string;
}
}
}
148 changes: 74 additions & 74 deletions models/yang/common/sonic-extensions.yang
Original file line number Diff line number Diff line change
@@ -1,83 +1,83 @@
module sonic-extensions {

yang-version "1";
yang-version "1";

// namespace
namespace "http://openconfig.net/yang/sonic-ext";
// namespace
namespace "http://openconfig.net/yang/sonic-ext";

prefix "sonic-ext";
prefix "sonic-ext";

// meta
organization "Sonic working group";
// meta
organization "Sonic working group";

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

description
"This module provides extensions to the YANG language to allow
Sonic specific functionality and meta-data to be defined.";

revision "2019-08-30" {
description
"Add extensions for redis DB mappings to identify the Redis DB name.";
}

revision "2019-07-26" {
description
"Add extensionis for redis DB mappings for table, table-keys, table-fields and corresponding transformer methods.";
}


// extension statements
extension table-name {
argument "table-name";
description "Db table name.";
}

extension key-transformer {
argument "key-transformer-name";
description "Db table key transformer name indicating that the list keys together form db table keys.";
}

extension key-delimiter {
argument "key-delimiter-string";
description "Db table key values delimiter.";
}

extension field-name {
argument "field-name";
description "Db table field name.";
}

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
or choose a specific DB field based on the type of yang value.";
}

extension subtree-transformer {
argument "subtree-transformer-name";
description "Subtree/node level transformer name that will have db mappings for an entire yang subtree.";
}

extension post-transformer {
argument "post-transformer-name";
description "Transformer name that will perform post-translation tasks.";
}

extension get-validate {
argument "get-validate-name";
description "Validation callpoint used to validate a YANG node during data translation back to YANG as a response to GET.";
}

extension redis-db-name {
argument "db-name";
description "DB name that will indicate where data is stored. Eg: Config DB, App DB etc";
}
extension table-transformer {
argument "table-transformer-name";
description "Db table transformer name.This can be applied to either transform yang value to some different format
or choose a specific DB table based on the type.";
}
"This module provides extensions to the YANG language to allow
Sonic specific functionality and meta-data to be defined.";

revision "2019-08-30" {
description
"Add extensions for redis DB mappings to identify the Redis DB name.";
}

revision "2019-07-26" {
description
"Add extensionis for redis DB mappings for table, table-keys, table-fields and corresponding transformer methods.";
}


// extension statements
extension table-name {
argument "table-name";
description "Db table name.";
}

extension key-transformer {
argument "key-transformer-name";
description "Db table key transformer name indicating that the list keys together form db table keys.";
}

extension key-delimiter {
argument "key-delimiter-string";
description "Db table key values delimiter.";
}

extension field-name {
argument "field-name";
description "Db table field name.";
}

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
or choose a specific DB field based on the type of yang value.";
}

extension subtree-transformer {
argument "subtree-transformer-name";
description "Subtree/node level transformer name that will have db mappings for an entire yang subtree.";
}

extension post-transformer {
argument "post-transformer-name";
description "Transformer name that will perform post-translation tasks.";
}

extension get-validate {
argument "get-validate-name";
description "Validation callpoint used to validate a YANG node during data translation back to YANG as a response to GET.";
}

extension redis-db-name {
argument "db-name";
description "DB name that will indicate where data is stored. Eg: Config DB, App DB etc";
}
extension table-transformer {
argument "table-transformer-name";
description "Db table transformer name.This can be applied to either transform yang value to some different format
or choose a specific DB table based on the type.";
}
}
79 changes: 79 additions & 0 deletions models/yang/common/sonic-port.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
module sonic-port {
namespace "http://github.com/Azure/sonic-port";
prefix prt;

import ietf-yang-types {
prefix yang;
}

import sonic-common {
prefix scommon;
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC VLAN";

revision 2019-05-15 {
description
"Initial revision.";
}


container sonic-port {
list PORT {
key "ifname";

leaf ifname {
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;
}
}
}

leaf index {
type uint16;
}

leaf speed {
type uint64;
}

leaf valid_speeds {
type string;
}

leaf alias {
type string;
}

leaf description {
type string;
}

leaf mtu{
type uint32 {
range "1312..9216" {
error-message "Invalid MTU value";
error-app-tag mtu-invalid;
}
}
}

leaf lanes {
type string;
}

leaf admin_status {
type scommon:admin-status;
}
}
}
}
Loading

0 comments on commit 28351cd

Please sign in to comment.