Skip to content

Commit

Permalink
Changes in sonic-sairedis repo to support the NAT feature. (sonic-net…
Browse files Browse the repository at this point in the history
…#519)

* Changes in sonic-sairedis repo to support the NAT feature.

Signed-off-by: kiran.kella@broadcom.com
  • Loading branch information
kirankella authored and lguohan committed Nov 22, 2019
1 parent 5337490 commit 5ef1764
Show file tree
Hide file tree
Showing 23 changed files with 743 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/inc/sai_redis.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ extern const sai_virtual_router_api_t redis_virtual_router_api;
extern const sai_vlan_api_t redis_vlan_api;
extern const sai_wred_api_t redis_wred_api;
extern const sai_debug_counter_api_t redis_debug_counter_api;
extern const sai_nat_api_t redis_nat_api;

#define UNREFERENCED_PARAMETER(X)

Expand Down Expand Up @@ -194,6 +195,7 @@ REDIS_ENTRY_QUAD(l2mc_entry);
REDIS_ENTRY_QUAD(mcast_fdb_entry);
REDIS_ENTRY_QUAD(neighbor_entry);
REDIS_ENTRY_QUAD(route_entry);
REDIS_ENTRY_QUAD(nat_entry);

// BULK

Expand Down
1 change: 1 addition & 0 deletions lib/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ libsairedis_la_SOURCES = \
sai_redis_virtual_router.cpp \
sai_redis_vlan.cpp \
sai_redis_wred.cpp \
sai_redis_nat.cpp \
sai_redis_generic_create.cpp \
sai_redis_generic_remove.cpp \
sai_redis_generic_set.cpp \
Expand Down
1 change: 1 addition & 0 deletions lib/src/sai_redis_generic_create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,3 +412,4 @@ REDIS_ENTRY_CREATE(L2MC_ENTRY,l2mc_entry);
REDIS_ENTRY_CREATE(MCAST_FDB_ENTRY,mcast_fdb_entry);
REDIS_ENTRY_CREATE(NEIGHBOR_ENTRY,neighbor_entry);
REDIS_ENTRY_CREATE(ROUTE_ENTRY,route_entry);
REDIS_ENTRY_CREATE(NAT_ENTRY,nat_entry);
1 change: 1 addition & 0 deletions lib/src/sai_redis_generic_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,4 @@ REDIS_ENTRY_GET(L2MC_ENTRY,l2mc_entry);
REDIS_ENTRY_GET(MCAST_FDB_ENTRY,mcast_fdb_entry);
REDIS_ENTRY_GET(NEIGHBOR_ENTRY,neighbor_entry);
REDIS_ENTRY_GET(ROUTE_ENTRY,route_entry);
REDIS_ENTRY_GET(NAT_ENTRY,nat_entry);
1 change: 1 addition & 0 deletions lib/src/sai_redis_generic_remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ REDIS_ENTRY_REMOVE(L2MC_ENTRY,l2mc_entry);
REDIS_ENTRY_REMOVE(MCAST_FDB_ENTRY,mcast_fdb_entry);
REDIS_ENTRY_REMOVE(NEIGHBOR_ENTRY,neighbor_entry);
REDIS_ENTRY_REMOVE(ROUTE_ENTRY,route_entry);
REDIS_ENTRY_REMOVE(NAT_ENTRY,nat_entry);
1 change: 1 addition & 0 deletions lib/src/sai_redis_generic_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,4 @@ REDIS_ENTRY_SET(L2MC_ENTRY,l2mc_entry);
REDIS_ENTRY_SET(MCAST_FDB_ENTRY,mcast_fdb_entry);
REDIS_ENTRY_SET(NEIGHBOR_ENTRY,neighbor_entry);
REDIS_ENTRY_SET(ROUTE_ENTRY,route_entry);
REDIS_ENTRY_SET(NAT_ENTRY,nat_entry);
1 change: 1 addition & 0 deletions lib/src/sai_redis_interfacequery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ sai_status_t sai_api_query(
API_CASE(VLAN,vlan);
API_CASE(WRED,wred);
API_CASE(DEBUG_COUNTER,debug_counter);
API_CASE(NAT,nat);

default:
SWSS_LOG_ERROR("Invalid API type %d", sai_api_id);
Expand Down
72 changes: 72 additions & 0 deletions lib/src/sai_redis_nat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#include "sai_redis.h"

sai_status_t sai_bulk_create_nat_entry(
_In_ uint32_t object_count,
_In_ const sai_nat_entry_t *nat_entry,
_In_ const uint32_t *attr_count,
_In_ const sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;
}

sai_status_t sai_bulk_remove_nat_entry(
_In_ uint32_t object_count,
_In_ const sai_nat_entry_t *nat_entry,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;

}

sai_status_t sai_bulk_set_nat_entry_attribute(
_In_ uint32_t object_count,
_In_ const sai_nat_entry_t *nat_entry,
_In_ const sai_attribute_t *attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;

}

sai_status_t sai_bulk_get_nat_entry_attribute(
_In_ uint32_t object_count,
_In_ const sai_nat_entry_t *nat_entry,
_In_ const uint32_t *attr_count,
_Inout_ sai_attribute_t **attr_list,
_In_ sai_bulk_op_error_mode_t mode,
_Out_ sai_status_t *object_statuses)
{
MUTEX();
SWSS_LOG_ENTER();

return SAI_STATUS_NOT_IMPLEMENTED;

}

REDIS_GENERIC_QUAD_ENTRY(NAT_ENTRY,nat_entry);
REDIS_GENERIC_QUAD(NAT_ZONE_COUNTER,nat_zone_counter);

const sai_nat_api_t redis_nat_api = {

REDIS_GENERIC_QUAD_API(nat_entry)

sai_bulk_create_nat_entry,
sai_bulk_remove_nat_entry,
sai_bulk_set_nat_entry_attribute,
sai_bulk_get_nat_entry_attribute,

REDIS_GENERIC_QUAD_API(nat_zone_counter)
};
Loading

0 comments on commit 5ef1764

Please sign in to comment.