Skip to content

Commit

Permalink
[swss]: Do not use namespace in header files (#1081)
Browse files Browse the repository at this point in the history
Signed-off-by: Wenda Ni <wenni@microsoft.com>
  • Loading branch information
wendani authored and stcheng committed Oct 3, 2019
1 parent bd36751 commit 953474a
Show file tree
Hide file tree
Showing 23 changed files with 221 additions and 216 deletions.
22 changes: 11 additions & 11 deletions cfgmgr/buffermgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ namespace swss {
#define LOSSLESS_PGS "3-4"

typedef struct{
string size;
string xon;
string xon_offset;
string xoff;
string threshold;
std::string size;
std::string xon;
std::string xon_offset;
std::string xoff;
std::string threshold;
} pg_profile_t;

typedef map<string, pg_profile_t> speed_map_t;
typedef map<string, speed_map_t> pg_profile_lookup_t;
typedef std::map<std::string, pg_profile_t> speed_map_t;
typedef std::map<std::string, speed_map_t> pg_profile_lookup_t;

typedef map<string, string> port_cable_length_t;
typedef std::map<std::string, std::string> port_cable_length_t;

class BufferMgr : public Orch
{
public:
BufferMgr(DBConnector *cfgDb, DBConnector *stateDb, string pg_lookup_file, const vector<string> &tableNames);
BufferMgr(DBConnector *cfgDb, DBConnector *stateDb, std::string pg_lookup_file, const std::vector<std::string> &tableNames);
using Orch::doTask;

private:
Expand All @@ -44,8 +44,8 @@ class BufferMgr : public Orch
port_cable_length_t m_cableLenLookup;
std::string getPgPoolMode();
void readPgProfileLookupFile(std::string);
task_process_status doCableTask(string port, string cable_length);
task_process_status doSpeedUpdateTask(string port, string speed);
task_process_status doCableTask(std::string port, std::string cable_length);
task_process_status doSpeedUpdateTask(std::string port, std::string speed);

void doTask(Consumer &consumer);
};
Expand Down
12 changes: 6 additions & 6 deletions cfgmgr/intfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ namespace swss {
class IntfMgr : public Orch
{
public:
IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames);
IntfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;

private:
ProducerStateTable m_appIntfTableProducer;
Table m_cfgIntfTable, m_cfgVlanIntfTable;
Table m_statePortTable, m_stateLagTable, m_stateVlanTable, m_stateVrfTable, m_stateIntfTable;

void setIntfIp(const string &alias, const string &opCmd, const IpPrefix &ipPrefix);
void setIntfVrf(const string &alias, const string vrfName);
bool doIntfGeneralTask(const vector<string>& keys, const vector<FieldValueTuple>& data, const string& op);
bool doIntfAddrTask(const vector<string>& keys, const vector<FieldValueTuple>& data, const string& op);
void setIntfIp(const std::string &alias, const std::string &opCmd, const IpPrefix &ipPrefix);
void setIntfVrf(const std::string &alias, const std::string vrfName);
bool doIntfGeneralTask(const std::vector<std::string>& keys, const std::vector<FieldValueTuple>& data, const std::string& op);
bool doIntfAddrTask(const std::vector<std::string>& keys, const std::vector<FieldValueTuple>& data, const std::string& op);
void doTask(Consumer &consumer);
bool isIntfStateOk(const string &alias);
bool isIntfStateOk(const std::string &alias);
};

}
Expand Down
6 changes: 3 additions & 3 deletions cfgmgr/nbrmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ namespace swss {
class NbrMgr : public Orch
{
public:
NbrMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames);
NbrMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;

bool isNeighRestoreDone();

private:
bool isIntfStateOk(const string &alias);
bool setNeighbor(const string& alias, const IpAddress& ip, const MacAddress& mac);
bool isIntfStateOk(const std::string &alias);
bool setNeighbor(const std::string& alias, const IpAddress& ip, const MacAddress& mac);

void doTask(Consumer &consumer);

Expand Down
10 changes: 5 additions & 5 deletions cfgmgr/portmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace swss {
class PortMgr : public Orch
{
public:
PortMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames);
PortMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);

using Orch::doTask;
private:
Expand All @@ -26,12 +26,12 @@ class PortMgr : public Orch
Table m_statePortTable;
ProducerStateTable m_appPortTable;

set<string> m_portList;
std::set<std::string> m_portList;

void doTask(Consumer &consumer);
bool setPortMtu(const string &alias, const string &mtu);
bool setPortAdminStatus(const string &alias, const bool up);
bool isPortStateOk(const string &alias);
bool setPortMtu(const std::string &alias, const std::string &mtu);
bool setPortAdminStatus(const std::string &alias, const bool up);
bool isPortStateOk(const std::string &alias);
};

}
26 changes: 13 additions & 13 deletions cfgmgr/teammgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TeamMgr : public Orch
{
public:
TeamMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *staDb,
const vector<TableConnector> &tables);
const std::vector<TableConnector> &tables);

using Orch::doTask;
private:
Expand All @@ -28,7 +28,7 @@ class TeamMgr : public Orch
ProducerStateTable m_appPortTable;
ProducerStateTable m_appLagTable;

set<string> m_lagList;
std::set<std::string> m_lagList;

MacAddress m_mac;

Expand All @@ -37,19 +37,19 @@ class TeamMgr : public Orch
void doLagMemberTask(Consumer &consumer);
void doPortUpdateTask(Consumer &consumer);

task_process_status addLag(const string &alias, int min_links, bool fall_back);
bool removeLag(const string &alias);
task_process_status addLagMember(const string &lag, const string &member);
bool removeLagMember(const string &lag, const string &member);
task_process_status addLag(const std::string &alias, int min_links, bool fall_back);
bool removeLag(const std::string &alias);
task_process_status addLagMember(const std::string &lag, const std::string &member);
bool removeLagMember(const std::string &lag, const std::string &member);

bool setLagAdminStatus(const string &alias, const string &admin_status);
bool setLagMtu(const string &alias, const string &mtu);
bool setLagAdminStatus(const std::string &alias, const std::string &admin_status);
bool setLagMtu(const std::string &alias, const std::string &mtu);

bool isPortEnslaved(const string &);
bool findPortMaster(string &, const string &);
bool checkPortIffUp(const string &);
bool isPortStateOk(const string&);
bool isLagStateOk(const string&);
bool isPortEnslaved(const std::string &);
bool findPortMaster(std::string &, const std::string &);
bool checkPortIffUp(const std::string &);
bool isPortStateOk(const std::string&);
bool isLagStateOk(const std::string&);
};

}
16 changes: 8 additions & 8 deletions cfgmgr/vlanmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace swss {
class VlanMgr : public Orch
{
public:
VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames);
VlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;

private:
Expand All @@ -27,18 +27,18 @@ class VlanMgr : public Orch
void doTask(Consumer &consumer);
void doVlanTask(Consumer &consumer);
void doVlanMemberTask(Consumer &consumer);
void processUntaggedVlanMembers(string vlan, const string &members);
void processUntaggedVlanMembers(std::string vlan, const std::string &members);

bool addHostVlan(int vlan_id);
bool removeHostVlan(int vlan_id);
bool setHostVlanAdminState(int vlan_id, const string &admin_status);
bool setHostVlanAdminState(int vlan_id, const std::string &admin_status);
bool setHostVlanMtu(int vlan_id, uint32_t mtu);
bool addHostVlanMember(int vlan_id, const string &port_alias, const string& tagging_mode);
bool removeHostVlanMember(int vlan_id, const string &port_alias);
bool isMemberStateOk(const string &alias);
bool isVlanStateOk(const string &alias);
bool addHostVlanMember(int vlan_id, const std::string &port_alias, const std::string& tagging_mode);
bool removeHostVlanMember(int vlan_id, const std::string &port_alias);
bool isMemberStateOk(const std::string &alias);
bool isVlanStateOk(const std::string &alias);
bool isVlanMacOk();
bool isVlanMemberStateOk(const string &vlanMemberKey);
bool isVlanMemberStateOk(const std::string &vlanMemberKey);
};

}
Expand Down
8 changes: 4 additions & 4 deletions cfgmgr/vrfmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ namespace swss {
class VrfMgr : public Orch
{
public:
VrfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<string> &tableNames);
VrfMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;

private:
bool delLink(const string& vrfName);
bool setLink(const string& vrfName);
bool delLink(const std::string& vrfName);
bool setLink(const std::string& vrfName);
void recycleTable(uint32_t table);
uint32_t getFreeTable(void);
void handleVnetConfigSet(KeyOpFieldsValuesTuple &t);
void doTask(Consumer &consumer);

map<string, uint32_t> m_vrfTableMap;
std::map<std::string, uint32_t> m_vrfTableMap;
set<uint32_t> m_freeTables;

Table m_stateVrfTable;
Expand Down
2 changes: 1 addition & 1 deletion cfgmgr/vxlanmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace swss {
class VxlanMgr : public Orch
{
public:
VxlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const vector<std::string> &tableNames);
VxlanMgr(DBConnector *cfgDb, DBConnector *appDb, DBConnector *stateDb, const std::vector<std::string> &tableNames);
using Orch::doTask;

typedef struct VxlanInfo
Expand Down
48 changes: 24 additions & 24 deletions orchagent/copporch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
#include "orch.h"

// trap fields
const string copp_trap_id_list = "trap_ids";
const string copp_trap_action_field = "trap_action";
const string copp_trap_priority_field = "trap_priority";
const std::string copp_trap_id_list = "trap_ids";
const std::string copp_trap_action_field = "trap_action";
const std::string copp_trap_priority_field = "trap_priority";

const string copp_queue_field = "queue";
const std::string copp_queue_field = "queue";

// policer fields
const string copp_policer_meter_type_field = "meter_type";
const string copp_policer_mode_field = "mode";
const string copp_policer_color_field = "color";
const string copp_policer_cbs_field = "cbs";
const string copp_policer_cir_field = "cir";
const string copp_policer_pbs_field = "pbs";
const string copp_policer_pir_field = "pir";
const string copp_policer_action_green_field = "green_action";
const string copp_policer_action_red_field = "red_action";
const string copp_policer_action_yellow_field = "yellow_action";
const std::string copp_policer_meter_type_field = "meter_type";
const std::string copp_policer_mode_field = "mode";
const std::string copp_policer_color_field = "color";
const std::string copp_policer_cbs_field = "cbs";
const std::string copp_policer_cir_field = "cir";
const std::string copp_policer_pbs_field = "pbs";
const std::string copp_policer_pir_field = "pir";
const std::string copp_policer_action_green_field = "green_action";
const std::string copp_policer_action_red_field = "red_action";
const std::string copp_policer_action_yellow_field = "yellow_action";

/* TrapGroupPolicerTable: trap group ID, policer ID */
typedef map<sai_object_id_t, sai_object_id_t> TrapGroupPolicerTable;
typedef std::map<sai_object_id_t, sai_object_id_t> TrapGroupPolicerTable;
/* TrapIdTrapGroupTable: trap ID, trap group ID */
typedef map<sai_hostif_trap_type_t, sai_object_id_t> TrapIdTrapGroupTable;
typedef std::map<sai_hostif_trap_type_t, sai_object_id_t> TrapIdTrapGroupTable;

class CoppOrch : public Orch
{
public:
CoppOrch(DBConnector *db, string tableName);
CoppOrch(swss::DBConnector *db, std::string tableName);
protected:
object_map m_trap_group_map;

Expand All @@ -44,15 +44,15 @@ class CoppOrch : public Orch
void initDefaultTrapIds();

task_process_status processCoppRule(Consumer& consumer);
bool isValidList(vector<string> &trap_id_list, vector<string> &all_items) const;
void getTrapIdList(vector<string> &trap_id_name_list, vector<sai_hostif_trap_type_t> &trap_id_list) const;
bool applyTrapIds(sai_object_id_t trap_group, vector<string> &trap_id_name_list, vector<sai_attribute_t> &trap_id_attribs);
bool applyAttributesToTrapIds(sai_object_id_t trap_group_id, const vector<sai_hostif_trap_type_t> &trap_id_list, vector<sai_attribute_t> &trap_id_attribs);
bool isValidList(std::vector<std::string> &trap_id_list, std::vector<std::string> &all_items) const;
void getTrapIdList(std::vector<std::string> &trap_id_name_list, std::vector<sai_hostif_trap_type_t> &trap_id_list) const;
bool applyTrapIds(sai_object_id_t trap_group, std::vector<std::string> &trap_id_name_list, std::vector<sai_attribute_t> &trap_id_attribs);
bool applyAttributesToTrapIds(sai_object_id_t trap_group_id, const std::vector<sai_hostif_trap_type_t> &trap_id_list, std::vector<sai_attribute_t> &trap_id_attribs);

bool createPolicer(string trap_group, vector<sai_attribute_t> &policer_attribs);
bool removePolicer(string trap_group_name);
bool createPolicer(std::string trap_group, std::vector<sai_attribute_t> &policer_attribs);
bool removePolicer(std::string trap_group_name);

sai_object_id_t getPolicer(string trap_group_name);
sai_object_id_t getPolicer(std::string trap_group_name);

virtual void doTask(Consumer& consumer);
};
Expand Down
24 changes: 12 additions & 12 deletions orchagent/countercheckorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ extern "C" {
#include "sai.h"
}

typedef vector<uint64_t> QueueMcCounters;
typedef array<uint64_t, PFC_WD_TC_MAX> PfcFrameCounters;
typedef std::vector<uint64_t> QueueMcCounters;
typedef std::array<uint64_t, PFC_WD_TC_MAX> PfcFrameCounters;

class CounterCheckOrch: public Orch
{
public:
static CounterCheckOrch& getInstance(DBConnector *db = nullptr);
virtual void doTask(SelectableTimer &timer);
static CounterCheckOrch& getInstance(swss::DBConnector *db = nullptr);
virtual void doTask(swss::SelectableTimer &timer);
virtual void doTask(Consumer &consumer) {}
void addPort(const Port& port);
void removePort(const Port& port);
void addPort(const swss::Port& port);
void removePort(const swss::Port& port);

private:
CounterCheckOrch(DBConnector *db, vector<string> &tableNames);
CounterCheckOrch(swss::DBConnector *db, std::vector<std::string> &tableNames);
virtual ~CounterCheckOrch(void);
QueueMcCounters getQueueMcCounters(const Port& port);
QueueMcCounters getQueueMcCounters(const swss::Port& port);
PfcFrameCounters getPfcFrameCounters(sai_object_id_t portId);
void mcCounterCheck();
void pfcFrameCounterCheck();

map<sai_object_id_t, QueueMcCounters> m_mcCountersMap;
map<sai_object_id_t, PfcFrameCounters> m_pfcFrameCountersMap;
std::map<sai_object_id_t, QueueMcCounters> m_mcCountersMap;
std::map<sai_object_id_t, PfcFrameCounters> m_pfcFrameCountersMap;

shared_ptr<DBConnector> m_countersDb = nullptr;
shared_ptr<Table> m_countersTable = nullptr;
std::shared_ptr<swss::DBConnector> m_countersDb = nullptr;
std::shared_ptr<swss::Table> m_countersTable = nullptr;
};

#endif
1 change: 1 addition & 0 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern sai_switch_api_t *sai_switch_api;
extern sai_acl_api_t *sai_acl_api;

using namespace std;
using namespace swss;


const map<CrmResourceType, string> crmResTypeNameMap =
Expand Down
Loading

0 comments on commit 953474a

Please sign in to comment.