Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SONiC Yang model support for Mirror #7877

Merged
merged 17 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
'./yang-models/sonic-mgmt_interface.yang',
'./yang-models/sonic-mgmt_port.yang',
'./yang-models/sonic-mgmt_vrf.yang',
'./yang-models/sonic-mirror-session.yang',
'./yang-models/sonic-ntp.yang',
'./yang-models/sonic-nat.yang',
'./yang-models/sonic-port.yang',
Expand Down
19 changes: 19 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,25 @@
"PREFIX": {
"prefix1|1|10.0.0.0/8|8..16": {
}
},
"MIRROR_SESSION": {
"erspan": {
"direction": "RX",
"dscp": "10",
"dst_ip": "11.1.1.1",
"gre_type": "0x1234",
"queue": "0",
"src_ip": "10.1.1.1",
"src_port": "Ethernet1",
"ttl": "10",
"type": "ERSPAN"
},
"span": {
"direction": "RX",
"dst_port": "Ethernet2",
"src_port": "Ethernet3",
"type": "SPAN"
}
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"MIRROR_ERSPAN_ENTRY_WITH_VALID_VALUES": {
"desc": "Configuring ERSPAN entry with valid values."
},
"MIRROR_ERSPAN_ENTRY_WRONG_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid type",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DST_IP": {
"desc": "Configurinng ERSPAN entry with invalid dst_ip",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP": {
"desc": "Configurinng ERSPAN entry with invalid src_ip",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE": {
"desc": "Configurinng ERSPAN entry with invalid GRE type",
"eStrKey" : "Pattern"
},
"MIRROR_ERSPAN_ENTRY_WRONG_DSCP": {
"desc": "Configurinng ERSPAN entry with invalid dscp",
"eStr" : "Invalid dscp value"
},
"MIRROR_ERSPAN_ENTRY_WRONG_TTL": {
"desc": "Configurinng ERSPAN entry with invalid ttl",
"eStr": "Invalid TTL value"
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORT": {
"desc": "Configurinng ERSPAN entry with valid source port"
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": {
"desc": "Configurinng ERSPAN entry with valid source portchannel"
},
"MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": {
"desc": "Configurinng ERSPAN entry with invalid source port",
"eStrKey" : "InvalidValue"
},
"MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": {
"desc": "Configurinng SPAN entry with valid source and destination ports"
},
"MIRROR_SPAN_ENTRY_INVALID_DST_PORT": {
"desc": "Configurinng SPAN entry with invalid destination ports",
"eStrKey" : "LeafRef"
},
"MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": {
"desc": "Configurinng SPAN entry with invalid destination ports",
"eStrKey" : "InvalidValue"
},
"MIRROR_SPAN_ENTRY_INVALID_DIRECTION": {
"desc": "Configurinng SPAN entry with invalid direction",
"eStrKey" : "Pattern"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
{
"MIRROR_ERSPAN_ENTRY_WITH_VALID_VALUES": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_TYPE": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "Invalid",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_DST_IP": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "1001::1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_SRC_IP": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "1001::1",
"gre_type": "0x1234",
"dscp": "10"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_GRE_TYPE": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0",
"dscp": "10"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_DSCP": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "64"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_WRONG_TTL": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"ttl": "65"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORT": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "1",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"ttl": "63",
"src_port": "Ethernet0"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_VALID_SRC_PORTCHANNEL": {
"sonic-portchannel:sonic-portchannel": {
"sonic-portchannel:PORTCHANNEL": {
"PORTCHANNEL_LIST": [
{
"admin_status": "up",
"name": "PortChannel5"
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"ttl": "63",
"src_port": "PortChannel5"
}
]
}
}
},
"MIRROR_ERSPAN_ENTRY_INVALID_SRC_PORT": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "erspan",
"type": "ERSPAN",
"dst_ip": "11.1.1.1",
"src_ip": "10.1.1.1",
"gre_type": "0x1234",
"dscp": "10",
"ttl": "63",
"src_port": "Ethernet0"
}
]
}
}
},
"MIRROR_SPAN_ENTRY_WITH_VALID_VALUES": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "1",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
},
{
"admin_status": "up",
"alias": "eth1",
"description": "Ethernet4",
"lanes": "1",
"mtu": 9000,
"name": "Ethernet4",
"speed": 25000
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "span",
"type": "SPAN",
"dst_port": "Ethernet0",
"src_port": "Ethernet4",
"direction": "RX"
}
]
}
}
},
"MIRROR_SPAN_ENTRY_INVALID_DST_PORT": {
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "span",
"type": "SPAN",
"dst_port": "Ethernet0"
}
]
}
}
},
"MIRROR_SPAN_ENTRY_INVALID_SRC_PORT": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "1",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "span",
"type": "SPAN",
"dst_port": "Ethernet0",
"src_port": "Ethernet4"
}
]
}
}
},
"MIRROR_SPAN_ENTRY_INVALID_DIRECTION": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "1",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-mirror-session:sonic-mirror-session": {
"MIRROR_SESSION": {
"MIRROR_SESSION_LIST": [
{
"name": "span",
"type": "SPAN",
"dst_port": "Ethernet0",
"direction":"RXX"
}
]
}
}
}
}
Loading