Skip to content

Commit

Permalink
Added front panel port prefix regex to schema.h to support different …
Browse files Browse the repository at this point in the history
…front panel prefixes
  • Loading branch information
Itamar Talmon committed May 31, 2022
1 parent 6c007c0 commit 9796efb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions common/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,21 @@ namespace swss {
#define FRONT_PANEL_PORT_PREFIX "Ethernet"
#define PORTCHANNEL_PREFIX "PortChannel"
#define VLAN_PREFIX "Vlan"
/*
* In order to support different front panel ports prefix, we will
* add a regex that contains all the possible prefixes and need to be
* adjusted once new front panel prefix is added.
* e.g. if we want to add an "SwitchPort" prefix, we will add a new
* #define FRONT_PANEL_SWP_PORT_PREFIX "SwitchPort"
* and update the regex as follows -
* #define FRONT_PANEL_PORT_PREFIX_REGEX "^(" FRONT_PANEL_PORT_PREFIX "|" FRONT_PANEL_SWP_PORT_PREFIX ")(\\d+)"
*
* IMPORTANT - now checking for front panel prefixes should only be done using a
* regex library.
* in CPP - import <regex> and use std::regex_match(port_name_str, std::regex(FRONT_PANEL_PORT_PREFIX_REGEX))
* in python - import re and use re.match(swsscommon.FRONT_PANEL_PORT_PREFIX_REGEX, port_name_str)
*/
#define FRONT_PANEL_PORT_PREFIX_REGEX "^(" FRONT_PANEL_PORT_PREFIX ")(\\d+)"

#define SET_COMMAND "SET"
#define DEL_COMMAND "DEL"
Expand Down

0 comments on commit 9796efb

Please sign in to comment.