Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 9 additions & 2 deletions dataplane/apigen/docparser/docparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ type Paragraph struct {

// SimpleSect contains a description of an element.
type SimpleSect struct {
Para string `xml:"para"`
Para struct {
InnerXML string `xml:",innerxml"`
} `xml:"para"`
}

// ParseSAIXMLDir parses all the SAI Doxygen XML files in a directory.
Expand Down Expand Up @@ -149,10 +151,15 @@ func memberToAttrInfo(enum MemberDef) (*Attr, error) {
trimStr := strings.TrimSuffix(strings.TrimPrefix(enum.Name, "_"), "_t") + "_"

for i, value := range enum.EnumValues {
tagRegex := regexp.MustCompile(`<[^>]*>`)
var canCreate, canRead, canSet bool
var saiType string
for _, details := range value.DetailedDescription.Paragraph.SimpleSect {
annotation := strings.TrimSpace(details.Para)
// Handle nested XML tags by capturing raw content and then removing all
// tags using regex.
annotation := details.Para.InnerXML
annotation = tagRegex.ReplaceAllString(annotation, "")
annotation = strings.TrimSpace(annotation)
switch {
case strings.HasPrefix(annotation, "@@type"):
saiType = strings.TrimSpace(strings.TrimPrefix(annotation, "@@type"))
Expand Down
26 changes: 23 additions & 3 deletions dataplane/proto/sai/common.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dataplane/proto/sai/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4570,6 +4570,8 @@ message SwitchAttribute {
repeated DebugCounterType supported_debug_counter_type_list = 222 [(attr_enum_value) = 2112];
repeated InDropReason supported_ingress_drop_reason_list = 223 [(attr_enum_value) = 2113];
optional uint32 available_switch_ingress_drop_counters = 224 [(attr_enum_value) = 2118];
optional bool disable_ingress_vlan_checks = 225 [(attr_enum_value) = 238];
optional bool disable_egress_vlan_checks = 226 [(attr_enum_value) = 239];
}

message SwitchTunnelAttribute {
Expand Down
64 changes: 56 additions & 8 deletions dataplane/proto/sai/switch.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dataplane/proto/sai/switch.proto
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ enum SwitchAttr {
SWITCH_ATTR_MAX_ICMP_ECHO_SESSION = 235;
SWITCH_ATTR_STATS_COUNT_MODE = 236;
SWITCH_ATTR_SELECTIVE_COUNTER_LIST = 237;
SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS = 238;
SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS = 239;
}

enum SwitchTunnelAttr {
Expand Down Expand Up @@ -379,6 +381,8 @@ message CreateSwitchRequest {
repeated uint64 poe_device_list = 92 [(attr_enum_value) = 232];
optional StatsCountMode stats_count_mode = 93 [(attr_enum_value) = 236];
repeated uint64 selective_counter_list = 94 [(attr_enum_value) = 237];
optional bool disable_ingress_vlan_checks = 95 [(attr_enum_value) = 238];
optional bool disable_egress_vlan_checks = 96 [(attr_enum_value) = 239];
}

message CreateSwitchResponse {
Expand Down Expand Up @@ -487,6 +491,8 @@ message SetSwitchAttributeRequest {
repeated uint64 poe_device_list = 79 [(attr_enum_value) = 232];
optional StatsCountMode stats_count_mode = 80 [(attr_enum_value) = 236];
repeated uint64 selective_counter_list = 81 [(attr_enum_value) = 237];
optional bool disable_ingress_vlan_checks = 82 [(attr_enum_value) = 238];
optional bool disable_egress_vlan_checks = 83 [(attr_enum_value) = 239];
}

message SetSwitchAttributeResponse {}
Expand Down
2 changes: 2 additions & 0 deletions dataplane/saiserver/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,8 @@ func (sw *saiSwitch) CreateSwitch(ctx context.Context, _ *saipb.CreateSwitchRequ
SwitchShellEnable: proto.Bool(false),
SwitchProfileId: proto.Uint32(0),
NatZoneCounterObjectId: proto.Uint64(0),
DisableIngressVlanChecks: proto.Bool(false),
DisableEgressVlanChecks: proto.Bool(false),
SupportedObjectTypeList: []saipb.ObjectType{
saipb.ObjectType_OBJECT_TYPE_PORT,
saipb.ObjectType_OBJECT_TYPE_VLAN,
Expand Down
2 changes: 2 additions & 0 deletions dataplane/saiserver/switch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ func TestCreateSwitch(t *testing.T) {
SwitchShellEnable: proto.Bool(false),
SwitchProfileId: proto.Uint32(0),
NatZoneCounterObjectId: proto.Uint64(0),
DisableIngressVlanChecks: proto.Bool(false),
DisableEgressVlanChecks: proto.Bool(false),
SupportedObjectTypeList: []saipb.ObjectType{
saipb.ObjectType_OBJECT_TYPE_PORT,
saipb.ObjectType_OBJECT_TYPE_VLAN,
Expand Down
12 changes: 12 additions & 0 deletions dataplane/standalone/sai/enum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24855,6 +24855,12 @@ lemming::dataplane::sai::SwitchAttr convert_sai_switch_attr_t_to_proto(
case SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST:
return lemming::dataplane::sai::SWITCH_ATTR_SELECTIVE_COUNTER_LIST;

case SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS:
return lemming::dataplane::sai::SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS;

case SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS:
return lemming::dataplane::sai::SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS;

default:
return lemming::dataplane::sai::SWITCH_ATTR_UNSPECIFIED;
}
Expand Down Expand Up @@ -25591,6 +25597,12 @@ sai_switch_attr_t convert_sai_switch_attr_t_to_sai(
case lemming::dataplane::sai::SWITCH_ATTR_SELECTIVE_COUNTER_LIST:
return SAI_SWITCH_ATTR_SELECTIVE_COUNTER_LIST;

case lemming::dataplane::sai::SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS:
return SAI_SWITCH_ATTR_DISABLE_INGRESS_VLAN_CHECKS;

case lemming::dataplane::sai::SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS:
return SAI_SWITCH_ATTR_DISABLE_EGRESS_VLAN_CHECKS;

default:
return SAI_SWITCH_ATTR_NUMBER_OF_ACTIVE_PORTS;
}
Expand Down
Loading
Loading