Skip to content

Commit 28351cd

Browse files
GarrickHejoyas-joseph
authored andcommitted
sFlow CLI Template (#147)
* 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.
1 parent 1043f56 commit 28351cd

25 files changed

+3525
-284
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module sonic-vlan-annot {
2+
3+
yang-version "1.1";
4+
5+
namespace "http://openconfig.net/yang/annotation";
6+
prefix "svlan-annot";
7+
8+
import sonic-vlan { prefix svlan; }
9+
10+
11+
deviation /svlan:sonic-vlan-state/svlan:VLAN_TABLE {
12+
deviate add {
13+
sonic-ext:db-name "APPL_DB";
14+
}
15+
}
16+
17+
deviation /svlan:sonic-vlan-state/svlan:VLAN_MEMBER_TABLE {
18+
deviate add {
19+
sonic-ext:db-name "APPL_DB";
20+
}
21+
}
22+
}
23+

models/yang/common/sonic-common.yang

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
module sonic-common {
2+
namespace "http://github.com/Azure/sonic-common";
3+
prefix sv;
4+
5+
import ietf-yang-types {
6+
prefix yang;
7+
}
8+
9+
organization
10+
"SONiC";
11+
12+
contact
13+
"SONiC";
14+
15+
description
16+
"SONIC VLAN";
17+
18+
revision 2019-05-15 {
19+
description
20+
"Initial revision.";
21+
}
22+
23+
typedef tagging_mode {
24+
type enumeration {
25+
enum untagged;
26+
enum tagged;
27+
enum priority_tagged;
28+
}
29+
}
30+
31+
typedef admin-status {
32+
type enumeration {
33+
enum up;
34+
enum down;
35+
}
36+
}
37+
38+
typedef oper-status {
39+
type enumeration {
40+
enum up;
41+
enum down;
42+
}
43+
}
44+
45+
extension custom-handler {
46+
description
47+
"Node should be handled by custom handler";
48+
argument "name";
49+
}
50+
51+
extension db-name {
52+
description
53+
"DB name, e.g. APPL_DB, CONFIG_DB";
54+
argument "value";
55+
}
56+
57+
extension key-delim {
58+
description
59+
"Key delimeter, e.g. - |, :";
60+
argument "value";
61+
}
62+
63+
extension key-pattern {
64+
description
65+
"Key pattern, e.g. - ACL_RULE|{aclname}|{rulename}";
66+
argument "value";
67+
}
68+
69+
extension map-list {
70+
description
71+
"If it is a map list";
72+
argument "value";
73+
}
74+
75+
extension map-leaf {
76+
description
77+
"Map leaf names";
78+
argument "value";
79+
}
80+
81+
extension pf-check {
82+
description
83+
"Platform specific validation";
84+
argument "handler";
85+
}
86+
87+
container operation {
88+
leaf operation {
89+
type string;
90+
}
91+
}
92+
}
Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
module sonic-extensions {
22

3-
yang-version "1";
3+
yang-version "1";
44

5-
// namespace
6-
namespace "http://openconfig.net/yang/sonic-ext";
5+
// namespace
6+
namespace "http://openconfig.net/yang/sonic-ext";
77

8-
prefix "sonic-ext";
8+
prefix "sonic-ext";
99

10-
// meta
11-
organization "Sonic working group";
10+
// meta
11+
organization "Sonic working group";
1212

13-
contact
14-
"OpenConfig working group
15-
www.openconfig.net";
13+
contact
14+
"OpenConfig working group
15+
www.openconfig.net";
1616

17-
description
18-
"This module provides extensions to the YANG language to allow
19-
Sonic specific functionality and meta-data to be defined.";
20-
21-
revision "2019-08-30" {
22-
description
23-
"Add extensions for redis DB mappings to identify the Redis DB name.";
24-
}
25-
26-
revision "2019-07-26" {
2717
description
28-
"Add extensionis for redis DB mappings for table, table-keys, table-fields and corresponding transformer methods.";
29-
}
30-
31-
32-
// extension statements
33-
extension table-name {
34-
argument "table-name";
35-
description "Db table name.";
36-
}
37-
38-
extension key-transformer {
39-
argument "key-transformer-name";
40-
description "Db table key transformer name indicating that the list keys together form db table keys.";
41-
}
42-
43-
extension key-delimiter {
44-
argument "key-delimiter-string";
45-
description "Db table key values delimiter.";
46-
}
47-
48-
extension field-name {
49-
argument "field-name";
50-
description "Db table field name.";
51-
}
52-
53-
extension field-transformer {
54-
argument "field-transformer-name";
55-
description "Db table field transformer name.This can be applied to either transform yang value to some different format
56-
or choose a specific DB field based on the type of yang value.";
57-
}
58-
59-
extension subtree-transformer {
60-
argument "subtree-transformer-name";
61-
description "Subtree/node level transformer name that will have db mappings for an entire yang subtree.";
62-
}
63-
64-
extension post-transformer {
65-
argument "post-transformer-name";
66-
description "Transformer name that will perform post-translation tasks.";
67-
}
68-
69-
extension get-validate {
70-
argument "get-validate-name";
71-
description "Validation callpoint used to validate a YANG node during data translation back to YANG as a response to GET.";
72-
}
73-
74-
extension redis-db-name {
75-
argument "db-name";
76-
description "DB name that will indicate where data is stored. Eg: Config DB, App DB etc";
77-
}
78-
extension table-transformer {
79-
argument "table-transformer-name";
80-
description "Db table transformer name.This can be applied to either transform yang value to some different format
81-
or choose a specific DB table based on the type.";
82-
}
18+
"This module provides extensions to the YANG language to allow
19+
Sonic specific functionality and meta-data to be defined.";
20+
21+
revision "2019-08-30" {
22+
description
23+
"Add extensions for redis DB mappings to identify the Redis DB name.";
24+
}
25+
26+
revision "2019-07-26" {
27+
description
28+
"Add extensionis for redis DB mappings for table, table-keys, table-fields and corresponding transformer methods.";
29+
}
30+
31+
32+
// extension statements
33+
extension table-name {
34+
argument "table-name";
35+
description "Db table name.";
36+
}
37+
38+
extension key-transformer {
39+
argument "key-transformer-name";
40+
description "Db table key transformer name indicating that the list keys together form db table keys.";
41+
}
42+
43+
extension key-delimiter {
44+
argument "key-delimiter-string";
45+
description "Db table key values delimiter.";
46+
}
47+
48+
extension field-name {
49+
argument "field-name";
50+
description "Db table field name.";
51+
}
52+
53+
extension field-transformer {
54+
argument "field-transformer-name";
55+
description "Db table field transformer name.This can be applied to either transform yang value to some different format
56+
or choose a specific DB field based on the type of yang value.";
57+
}
58+
59+
extension subtree-transformer {
60+
argument "subtree-transformer-name";
61+
description "Subtree/node level transformer name that will have db mappings for an entire yang subtree.";
62+
}
63+
64+
extension post-transformer {
65+
argument "post-transformer-name";
66+
description "Transformer name that will perform post-translation tasks.";
67+
}
68+
69+
extension get-validate {
70+
argument "get-validate-name";
71+
description "Validation callpoint used to validate a YANG node during data translation back to YANG as a response to GET.";
72+
}
73+
74+
extension redis-db-name {
75+
argument "db-name";
76+
description "DB name that will indicate where data is stored. Eg: Config DB, App DB etc";
77+
}
78+
extension table-transformer {
79+
argument "table-transformer-name";
80+
description "Db table transformer name.This can be applied to either transform yang value to some different format
81+
or choose a specific DB table based on the type.";
82+
}
8383
}

models/yang/common/sonic-port.yang

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
module sonic-port {
2+
namespace "http://github.com/Azure/sonic-port";
3+
prefix prt;
4+
5+
import ietf-yang-types {
6+
prefix yang;
7+
}
8+
9+
import sonic-common {
10+
prefix scommon;
11+
}
12+
13+
organization
14+
"SONiC";
15+
16+
contact
17+
"SONiC";
18+
19+
description
20+
"SONIC VLAN";
21+
22+
revision 2019-05-15 {
23+
description
24+
"Initial revision.";
25+
}
26+
27+
28+
container sonic-port {
29+
list PORT {
30+
key "ifname";
31+
32+
leaf ifname {
33+
type string {
34+
pattern "Ethernet([1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[0-9])"{
35+
error-message "Invalid interface name";
36+
error-app-tag interface-name-invalid;
37+
}
38+
}
39+
}
40+
41+
leaf index {
42+
type uint16;
43+
}
44+
45+
leaf speed {
46+
type uint64;
47+
}
48+
49+
leaf valid_speeds {
50+
type string;
51+
}
52+
53+
leaf alias {
54+
type string;
55+
}
56+
57+
leaf description {
58+
type string;
59+
}
60+
61+
leaf mtu{
62+
type uint32 {
63+
range "1312..9216" {
64+
error-message "Invalid MTU value";
65+
error-app-tag mtu-invalid;
66+
}
67+
}
68+
}
69+
70+
leaf lanes {
71+
type string;
72+
}
73+
74+
leaf admin_status {
75+
type scommon:admin-status;
76+
}
77+
}
78+
}
79+
}

0 commit comments

Comments
 (0)