Skip to content

Commit

Permalink
Changes after review of separate vlan and vlan_member modules
Browse files Browse the repository at this point in the history
Signed-off-by: Raphael Tryster <raphaelt@nvidia.com>
  • Loading branch information
raphaelt-nvidia committed Oct 12, 2021
1 parent 737b4aa commit 256403f
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 58 deletions.
5 changes: 1 addition & 4 deletions dump/plugins/vlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def execute(self, params_dict):
self.init_vlan_config_info(vlan_name)
self.init_vlan_appl_info(vlan_name)
self.init_state_vlan_info(vlan_name)
req, vlan_table = self.init_asic_vlan_info(vlan_name)
self.init_asic_vlan_info(vlan_name)
return self.ret_temp

def init_vlan_config_info(self, vlan_name):
Expand Down Expand Up @@ -66,7 +66,4 @@ def init_asic_vlan_info(self, vlan_name):
self.ret_temp[req.db]["keys"] = ret["keys"]
else:
self.ret_temp[req.db]["tables_not_found"] = [req.table]

# Return request and table to caller in case its next call is to init_asic_vlan_member_info which also needs it
return req, ret

4 changes: 2 additions & 2 deletions dump/plugins/vlan_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def get_all_args(self, ns=""):
req = MatchRequest(db="CONFIG_DB", table="VLAN_MEMBER", key_pattern="*", ns=ns)
ret = self.match_engine.fetch(req)
all_vlans = ret["keys"]
return [(key.split("|")[-2]+'|'+key.split("|")[-1]) for key in all_vlans]
return [key.split("|",1)[-1] for key in all_vlans]

def execute(self, params_dict):
self.ret_temp = create_template_dict(dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB", "STATE_DB"])
Expand Down Expand Up @@ -102,7 +102,7 @@ def init_asic_vlan_member_info(self, vlan_name, member_name):
if sai_hostif_obj_key in hostif_ret["return_values"] and "SAI_HOSTIF_ATTR_OBJ_ID" in hostif_ret["return_values"][sai_hostif_obj_key]:
member_oid = hostif_ret["return_values"][sai_hostif_obj_key]["SAI_HOSTIF_ATTR_OBJ_ID"]

# Find the table named "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:oid:*" in which field SAI_BRIDGE_PORT_ATTR_PORT_ID = vlan OID
# Find the table named "ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT:oid:*" in which field SAI_BRIDGE_PORT_ATTR_PORT_ID = vlan member OID
if member_oid:
req = MatchRequest(db="ASIC_DB", table="ASIC_STATE:SAI_OBJECT_TYPE_BRIDGE_PORT", key_pattern="*",
field="SAI_BRIDGE_PORT_ATTR_PORT_ID", value=member_oid, ns=self.ns)
Expand Down
28 changes: 14 additions & 14 deletions tests/dump_input/vlan/appl_db.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
{
{
"VLAN_TABLE:Vlan2": {
"admin_status": "up",
"host_ifname": "",
"mac": "7c:fe:90:f5:36:40",
"mtu": "9100"
},
},
"VLAN_TABLE:Vlan3": {
"admin_status": "up",
"host_ifname": "",
"mac": "7c:fe:90:f5:36:40",
"mtu": "9100"
},
},
"VLAN_MEMBER_TABLE:Vlan3:Ethernet8": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER_TABLE:Vlan3:Ethernet0": {
"tagging_mode": "tagged"
},
},
"VLAN_TABLE:Vlan4": {
"admin_status": "up",
"host_ifname": "",
"mac": "7c:fe:90:f5:36:40",
"mtu": "9100"
},
},
"VLAN_MEMBER_TABLE:Vlan4:Ethernet16": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER_TABLE:Vlan4:Ethernet24": {
"tagging_mode": "tagged"
},
},
"VLAN_TABLE:Vlan7": {
"admin_status": "up",
"host_ifname": "",
"mac": "7c:fe:90:f5:36:40",
"mtu": "9100"
},
},
"VLAN_MEMBER_TABLE:Vlan7:Ethernet48": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER_TABLE:Vlan7:Ethernet56": {
"tagging_mode": "tagged"
},
},
"VLAN_TABLE:Vlan8": {
"admin_status": "up",
"host_ifname": "",
"mac": "7c:fe:90:f5:36:40",
"mtu": "9100"
},
},
"VLAN_MEMBER_TABLE:Vlan8:Ethernet64": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER_TABLE:Vlan8:Ethernet72": {
"tagging_mode": "tagged"
}
}
}
10 changes: 5 additions & 5 deletions tests/dump_input/vlan/asic_db.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000617":{
"SAI_VLAN_ATTR_VLAN_ID": "2"
},
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000617":{
"SAI_VLAN_ATTR_VLAN_ID": "2"
},
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN:oid:0x26000000000618":{
"SAI_VLAN_ATTR_VLAN_ID": "3"
},
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x2700000000061e": {
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x2700000000061e": {
"SAI_VLAN_MEMBER_ATTR_BRIDGE_PORT_ID": "oid:0x3a00000000061d",
"SAI_VLAN_MEMBER_ATTR_VLAN_ID": "oid:0x26000000000618",
"SAI_VLAN_MEMBER_ATTR_VLAN_TAGGING_MODE": "SAI_VLAN_TAGGING_MODE_TAGGED"
},
},
"ASIC_STATE:SAI_OBJECT_TYPE_VLAN_MEMBER:oid:0x27000000000620": {
"SAI_VLAN_MEMBER_ATTR_BRIDGE_PORT_ID": "oid:0x3a00000000061f",
"SAI_VLAN_MEMBER_ATTR_VLAN_ID": "oid:0x26000000000618",
Expand Down
40 changes: 20 additions & 20 deletions tests/dump_input/vlan/config_db.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
{
"VLAN|Vlan2": {
"vlanid" : "2"
},
"VLAN|Vlan2": {
"vlanid" : "2"
},
"VLAN|Vlan3": {
"vlanid" : "3"
},
},
"VLAN_MEMBER|Vlan3|Ethernet0": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER|Vlan3|Ethernet8": {
"tagging_mode": "tagged"
},
},
"VLAN|Vlan4": {
"vlanid" : "4"
},
},
"VLAN_MEMBER|Vlan4|Ethernet16": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER|Vlan4|Ethernet24": {
"tagging_mode": "tagged"
},
},
"VLAN_INTERFACE|Vlan4|192.168.1.2/24": {
"NULL": "NULL"
},
},
"VLAN_INTERFACE|Vlan4": {
"NULL": "NULL"
},
},
"VLAN|Vlan6": {
"vlanid" : "6"
},
},
"VLAN_MEMBER|Vlan6|Ethernet32": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER|Vlan6|Ethernet40": {
"tagging_mode": "tagged"
},
},
"VLAN|Vlan7": {
"vlanid" : "7"
},
},
"VLAN_MEMBER|Vlan7|Ethernet48": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER|Vlan7|Ethernet56": {
"tagging_mode": "tagged"
},
},
"VLAN|Vlan8": {
"vlanid" : "8"
},
},
"VLAN_MEMBER|Vlan8|Ethernet64": {
"tagging_mode": "tagged"
},
},
"VLAN_MEMBER|Vlan8|Ethernet72": {
"tagging_mode": "tagged"
}
}
}
26 changes: 13 additions & 13 deletions tests/dump_input/vlan/state_db.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
{
"VLAN_TABLE|Vlan2": {
"state": "ok"
},
},
"VLAN_TABLE|Vlan3": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan3|Ethernet8": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan3|Ethernet0": {
"state": "ok"
},
},
"VLAN_TABLE|Vlan4": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan4|Ethernet16": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan4|Ethernet24": {
"state": "ok"
},
},
"VLAN_TABLE|Vlan6": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan6|Ethernet32": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan6|Ethernet40": {
"state": "ok"
},
},
"VLAN_TABLE|Vlan8": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan8|Ethernet64": {
"state": "ok"
},
},
"VLAN_MEMBER_TABLE|Vlan8|Ethernet72": {
"state": "ok"
}
}
}

0 comments on commit 256403f

Please sign in to comment.