summaryrefslogtreecommitdiff
path: root/cleopatre/application/spidnetsnmp/agent
diff options
context:
space:
mode:
authorLysin Miao2012-05-11 15:11:41 +0800
committerLysin Miao2012-05-21 18:16:20 +0800
commit4ebc575bc39900f0c70b205c3ff9cc7abe5402c2 (patch)
treed9c176ddb0e00185f4c1ab0c919f1012a5076098 /cleopatre/application/spidnetsnmp/agent
parente0c0ee022e774d1e6f63fcf97e437df5338a918d (diff)
cleo/app/spidnetsnmp[eoc]: implement eocBroadcastStormProtectionGroup of the NSCRTV-EPONEOC-MOD-EOC-MIB, closes #3027
Diffstat (limited to 'cleopatre/application/spidnetsnmp/agent')
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup.h2
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable.h10
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable.h30
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access.c196
-rw-r--r--cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set.c332
6 files changed, 287 insertions, 285 deletions
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib.h
index fb71610383..2314dbf1e7 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib.h
@@ -8,5 +8,5 @@ config_require(mstar-eoc-mib/eocStatisticGroup)
//config_require(mstar-eoc-mib/eocCBATCardMACGroup)
//config_require(mstar-eoc-mib/eocTrapGroup)
//config_require(mstar-eoc-mib/eocVLANGroup)
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup)
config_require(mstar-eoc-mib/eocExtObjects)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup.h
index a693647bf0..4bd1c9ee08 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup.h
@@ -1 +1 @@
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable.h
index e6ba2f19a9..cca9d08f01 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable.h
@@ -1,5 +1,5 @@
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set)
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_get)
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable)
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_interface)
-//config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_get)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_interface)
+config_require(mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access)
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable.h b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable.h
index 9c93b28bb2..1260a0266f 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable.h
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable.h
@@ -19,13 +19,6 @@ extern "C" {
#include <net-snmp/library/asn1.h>
/* other required module components */
- /* *INDENT-OFF* */
-config_add_mib(NSCRTV-EPONEOC-MOD-EOC-MIB)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_interface)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_get)
-config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set)
- /* *INDENT-ON* */
/* OID and column number definitions for eocBroadcastStormProtectionTable */
#include "eocBroadcastStormProtectionTable_oids.h"
@@ -33,6 +26,9 @@ config_require(NSCRTV-EPONEOC-MOD-EOC-MIB/eocBroadcastStormProtectionTable/eocBr
/* enum definions */
#include "eocBroadcastStormProtectionTable_enums.h"
+/* include common header */
+#include "EoCCommon.h"
+
/* *********************************************************************
* function declarations
*/
@@ -76,37 +72,37 @@ typedef netsnmp_data_list eocBroadcastStormProtectionTable_registration;
* eocBroadcastStormProtectionTable.
*/
typedef struct eocBroadcastStormProtectionTable_data_s {
-
+
/*
* eocBroadcastStormProtectionEN(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocBroadcastStormProtectionEN;
-
+
/*
* eocBroadcastStormThreshold(5)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocBroadcastStormThreshold;
-
+
/*
* eocMulticastStormProtectionEN(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocMulticastStormProtectionEN;
-
+
/*
* eocMulticastStormThreshold(7)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocMulticastStormThreshold;
-
+
/*
* eocUnknownUnicastStormProtectionEN(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
*/
u_long eocUnknownUnicastStormProtectionEN;
-
+
/*
* eocUnknownUnicastStormThreshold(9)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
*/
long eocUnknownUnicastStormThreshold;
-
+
} eocBroadcastStormProtectionTable_data;
@@ -160,9 +156,9 @@ typedef struct eocBroadcastStormProtectionTable_rowreq_ctx_s {
/** this must be first for container compare to work */
netsnmp_index oid_idx;
oid oid_tmp[MAX_eocBroadcastStormProtectionTable_IDX_LEN];
-
+
eocBroadcastStormProtectionTable_mib_index tbl_idx;
-
+
eocBroadcastStormProtectionTable_data data;
eocBroadcastStormProtectionTable_undo_data * undo;
unsigned int column_set_flags; /* flags for set columns */
@@ -177,7 +173,7 @@ typedef struct eocBroadcastStormProtectionTable_rowreq_ctx_s {
/*
* TODO:131:o: | |-> Add useful data to eocBroadcastStormProtectionTable rowreq context.
*/
-
+
/*
* storage for future expansion
*/
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access.c
index 095ecf47ca..c425365677 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_access.c
@@ -1,6 +1,6 @@
/*
* Note: this file originally auto-generated by mib2c using
- * version : 14170 $ of $
+ * version : 14170 $ of $
*
* $Id:$
*/
@@ -15,12 +15,13 @@
#include "eocBroadcastStormProtectionTable_data_access.h"
+
/** @ingroup interface
* @addtogroup data_access data_access: Routines to access data
*
* These routines are used to locate the data used to satisfy
* requests.
- *
+ *
* @{
*/
/**********************************************************************
@@ -96,7 +97,7 @@ eocBroadcastStormProtectionTable_container_init(netsnmp_container **container_pt
netsnmp_cache *cache)
{
DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionTable_container_init","called\n"));
-
+
if (NULL == container_ptr_ptr) {
snmp_log(LOG_ERR,"bad container param to eocBroadcastStormProtectionTable_container_init\n");
return;
@@ -144,7 +145,7 @@ void
eocBroadcastStormProtectionTable_container_shutdown(netsnmp_container *container_ptr)
{
DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionTable_container_shutdown","called\n"));
-
+
if (NULL == container_ptr) {
snmp_log(LOG_ERR,"bad params to eocBroadcastStormProtectionTable_container_shutdown\n");
return;
@@ -189,124 +190,93 @@ int
eocBroadcastStormProtectionTable_container_load(netsnmp_container *container)
{
eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx;
- size_t count = 0;
- /*
- * temporary storage for index values
- */
- /*
- * eocBroadcastStormProtectionCBATCardIndex(1)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocBroadcastStormProtectionCBATCardIndex;
- /*
- * eocBroadcastStormProtectionCNUIndex(2)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocBroadcastStormProtectionCNUIndex;
- /*
- * eocBroadcastStormProtectionPortIndex(3)/INTEGER/ASN_INTEGER/long(long)//l/A/w/e/r/d/h
- */
- long eocBroadcastStormProtectionPortIndex;
-
-
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionTable_container_load","called\n"));
+ int rc = MFD_SUCCESS;
+ static libspid_eoc_storm_entry_t storm[LIBSPID_EOC_STORM_ITMES_MAX];
+ static libspid_eoc_wl_entry_t wl[LIBSPID_WHITE_LIST_CONF_LINE_MAX_NB];
+ unsigned int storm_items = LIBSPID_EOC_STORM_ITMES_MAX;
+ int wl_cnt = 0;
+ int i = 0, j = 0;
+ int count = 0 ;
+ int cun_index = 0;
- /*
- * TODO:351:M: |-> Load/update data in the eocBroadcastStormProtectionTable container.
- * loop over your eocBroadcastStormProtectionTable data, allocate a rowreq context,
- * set the index(es) [and data, optionally] and insert into
- * the container.
- */
- while( 1 ) {
- /*
- * check for end of data; bail out if there is no more data
- */
- if( 1 )
- break;
+ memset (storm, 0, sizeof (storm));
- /*
- * TODO:352:M: | |-> set indexes in new eocBroadcastStormProtectionTable rowreq context.
- * data context will be set from the param (unless NULL,
- * in which case a new data context will be allocated)
- */
- rowreq_ctx = eocBroadcastStormProtectionTable_allocate_rowreq_ctx(NULL);
- if (NULL == rowreq_ctx) {
- snmp_log(LOG_ERR, "memory allocation failed\n");
- return MFD_RESOURCE_UNAVAILABLE;
+ if (LIBSPID_SUCCESS != libspid_eoc_storm_check ())
+ {
+ snmp_log (LOG_ERR, "get broadcast storm list check error\n");
+ }
+
+ rc = libspid_eoc_storm_get_list (&storm, &storm_items);
+ if (LIBSPID_SUCCESS != rc)
+ {
+ snmp_log (LOG_ERR, "get broadcast storm list error\n");
+ return MFD_ERROR;
+ }
+
+ if (storm_items)
+ rc = MFD_END_OF_DATA;
+
+
+ if (LIBSPID_SUCCESS != libspid_eoc_wl_get_list (wl, &wl_cnt))
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_wl_get_list error\r\n");
+ return MFD_ERROR;
+ }
+
+ for (i = 0 ; i < storm_items ; i ++ )
+ {
+ rowreq_ctx =
+ eocBroadcastStormProtectionTable_allocate_rowreq_ctx (NULL);
+ if (NULL == rowreq_ctx)
+ {
+ snmp_log (LOG_ERR,
+ "Broadcast Strom Protection table "
+ "entry allocation error\n");
+ return MFD_ERROR;
}
- if(MFD_SUCCESS != eocBroadcastStormProtectionTable_indexes_set(rowreq_ctx
- , eocBroadcastStormProtectionCBATCardIndex
- , eocBroadcastStormProtectionCNUIndex
- , eocBroadcastStormProtectionPortIndex
- )) {
- snmp_log(LOG_ERR,"error setting index while loading "
- "eocBroadcastStormProtectionTable data.\n");
- eocBroadcastStormProtectionTable_release_rowreq_ctx(rowreq_ctx);
+
+ for (j = 0; j < wl_cnt; j ++)
+ {
+ if (NULL == strcasestr (wl[j].mac_addr, storm[i].mac_addr))
+ {
+ continue;
+ }
+ cun_index = atoi (wl[j].tei) - 2;
+ break;
+ }
+
+ rc = eocBroadcastStormProtectionTable_indexes_set (
+ rowreq_ctx, 0, cun_index, atoi (storm[i].port_index));
+ if (MFD_SUCCESS != rc)
+ {
+ snmp_log (LOG_ERR,
+ "Broadcast Strom Protection set indexes error\n");
+ eocBroadcastStormProtectionTable_release_rowreq_ctx (rowreq_ctx);
continue;
}
- /*
- * TODO:352:r: | |-> populate eocBroadcastStormProtectionTable data context.
- * Populate data context here. (optionally, delay until row prep)
- */
- /*
- * TRANSIENT or semi-TRANSIENT data:
- * copy data or save any info needed to do it in row_prep.
- */
- /*
- * setup/save data for eocBroadcastStormProtectionEN
- * eocBroadcastStormProtectionEN(4)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocBroadcastStormProtectionEN = eocBroadcastStormProtectionEN;
-
- /*
- * setup/save data for eocBroadcastStormThreshold
- * eocBroadcastStormThreshold(5)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocBroadcastStormThreshold = eocBroadcastStormThreshold;
-
- /*
- * setup/save data for eocMulticastStormProtectionEN
- * eocMulticastStormProtectionEN(6)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocMulticastStormProtectionEN = eocMulticastStormProtectionEN;
-
- /*
- * setup/save data for eocMulticastStormThreshold
- * eocMulticastStormThreshold(7)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocMulticastStormThreshold = eocMulticastStormThreshold;
-
- /*
- * setup/save data for eocUnknownUnicastStormProtectionEN
- * eocUnknownUnicastStormProtectionEN(8)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocUnknownUnicastStormProtectionEN = eocUnknownUnicastStormProtectionEN;
-
- /*
- * setup/save data for eocUnknownUnicastStormThreshold
- * eocUnknownUnicastStormThreshold(9)/INTEGER/ASN_INTEGER/long(long)//l/A/W/e/r/d/h
- */
- /** no mapping */
- rowreq_ctx->data.eocUnknownUnicastStormThreshold = eocUnknownUnicastStormThreshold;
-
-
- /*
- * insert into table container
- */
- CONTAINER_INSERT(container, rowreq_ctx);
- ++count;
+ rowreq_ctx->data.eocBroadcastStormProtectionEN =
+ atoi (storm[i].bcast_protect_en);
+ rowreq_ctx->data.eocBroadcastStormThreshold =
+ atoi (storm[i].bcast_thres_hold);
+ rowreq_ctx->data.eocMulticastStormProtectionEN =
+ atoi (storm[i].multi_protect_en);
+ rowreq_ctx->data.eocMulticastStormThreshold =
+ atoi (storm[i].multi_thres_hold);
+ rowreq_ctx->data.eocUnknownUnicastStormProtectionEN =
+ atoi (storm[i].unknow_protect_en);
+ rowreq_ctx->data.eocUnknownUnicastStormThreshold =
+ atoi (storm[i].unknow_thres_hold);
+ CONTAINER_INSERT (container, rowreq_ctx);
+ count ++;
}
- DEBUGMSGT(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionTable_container_load",
- "inserted %d records\n", count));
-
- return MFD_SUCCESS;
-} /* eocBroadcastStormProtectionTable_container_load */
+ DEBUGMSGT (("verbose:eocBroadcastStormProtectionTable:"
+ "eocBroadcastStormProtectionTable_container_load",
+ "inserted %d records\n", count));
+ return rc;
+}
/**
* container clean up
diff --git a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set.c b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set.c
index 6e9469aac3..0ddfe5ca5e 100644
--- a/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set.c
+++ b/cleopatre/application/spidnetsnmp/agent/mibgroup/mstar-eoc-mib/eocBroadcastStormProtectionGroup/eocBroadcastStormProtectionTable/eocBroadcastStormProtectionTable_data_set.c
@@ -18,7 +18,7 @@
*
* These routines are used to set the value for individual objects. The
* row context is passed, along with the new value.
- *
+ *
* @{
*/
/**********************************************************************
@@ -241,18 +241,22 @@ eocBroadcastStormProtectionTable_commit( eocBroadcastStormProtectionTable_rowreq
{
int rc = MFD_SUCCESS;
int save_flags;
+ static libspid_eoc_wl_entry_t wl[LIBSPID_WHITE_LIST_CONF_LINE_MAX_NB];
+ int wl_cnt = 0;
+ int i = 0;
+ libspid_eoc_storm_entry_t storm;
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionTable_commit","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocBroadcastStormProtectionTable_commit", "called\n"));
/** we should have a non-NULL pointer */
- netsnmp_assert( NULL != rowreq_ctx );
+ netsnmp_assert ( NULL != rowreq_ctx );
/*
* save flags, then clear until we actually do something
*/
save_flags = rowreq_ctx->column_set_flags;
rowreq_ctx->column_set_flags = 0;
-
/*
* commit eocBroadcastStormProtectionTable data
* 1) check the column's flag in save_flags to see if it was set.
@@ -260,106 +264,128 @@ eocBroadcastStormProtectionTable_commit( eocBroadcastStormProtectionTable_rowreq
* 3) set the column's flag in column_set_flags if it needs undo
* processing in case of a failure.
*/
- if (save_flags & COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG) {
- save_flags &= ~COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG; /* clear eocBroadcastStormProtectionEN */
- /*
- * TODO:482:o: |-> commit column eocBroadcastStormProtectionEN.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocBroadcastStormProtectionEN commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocBroadcastStormProtectionEN
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG;
- }
+ if (save_flags & COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG;
+ /*
+ * set flag, in case we need to undo eocBroadcastStormProtectionEN
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCBROADCASTSTORMPROTECTIONEN_FLAG;
+ }
+
+ if (save_flags & COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG;
+ /*
+ * set flag, in case we need to undo eocBroadcastStormThreshold
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG;
+ }
+
+ if (save_flags & COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG;
+ /*
+ * set flag, in case we need to undo eocMulticastStormProtectionEN
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG;
+ }
+
+ if (save_flags & COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG;
+ /*
+ * set flag, in case we need to undo eocMulticastStormThreshold
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG;
}
- if (save_flags & COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG) {
- save_flags &= ~COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG; /* clear eocBroadcastStormThreshold */
- /*
- * TODO:482:o: |-> commit column eocBroadcastStormThreshold.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocBroadcastStormThreshold commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocBroadcastStormThreshold
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCBROADCASTSTORMTHRESHOLD_FLAG;
- }
+ if (save_flags & COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG;
+ /*
+ * set flag, in case we need to undo
+ * eocUnknownUnicastStormProtectionEN
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG;
}
- if (save_flags & COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG) {
- save_flags &= ~COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG; /* clear eocMulticastStormProtectionEN */
- /*
- * TODO:482:o: |-> commit column eocMulticastStormProtectionEN.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocMulticastStormProtectionEN commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocMulticastStormProtectionEN
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCMULTICASTSTORMPROTECTIONEN_FLAG;
- }
+ if (save_flags & COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG)
+ {
+ save_flags &= ~COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG;
+ /*
+ * set flag, in case we need to undo eocUnknownUnicastStormThreshold
+ */
+ rowreq_ctx->column_set_flags |=
+ COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG;
}
- if (save_flags & COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG) {
- save_flags &= ~COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG; /* clear eocMulticastStormThreshold */
- /*
- * TODO:482:o: |-> commit column eocMulticastStormThreshold.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocMulticastStormThreshold commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocMulticastStormThreshold
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCMULTICASTSTORMTHRESHOLD_FLAG;
- }
+ if (LIBSPID_SUCCESS != libspid_eoc_wl_check ())
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_wl_check error\n");
+ return MFD_ERROR;
}
- if (save_flags & COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG) {
- save_flags &= ~COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG; /* clear eocUnknownUnicastStormProtectionEN */
- /*
- * TODO:482:o: |-> commit column eocUnknownUnicastStormProtectionEN.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocUnknownUnicastStormProtectionEN commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocUnknownUnicastStormProtectionEN
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCUNKNOWNUNICASTSTORMPROTECTIONEN_FLAG;
- }
+ if (LIBSPID_SUCCESS != libspid_eoc_storm_check ())
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_storm_check error\n");
+ return MFD_ERROR;
}
- if (save_flags & COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG) {
- save_flags &= ~COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG; /* clear eocUnknownUnicastStormThreshold */
- /*
- * TODO:482:o: |-> commit column eocUnknownUnicastStormThreshold.
- */
- rc = -1;
- if(-1 == rc) {
- snmp_log(LOG_ERR,"eocBroadcastStormProtectionTable column eocUnknownUnicastStormThreshold commit failed\n");
- }
- else {
- /*
- * set flag, in case we need to undo eocUnknownUnicastStormThreshold
- */
- rowreq_ctx->column_set_flags |= COLUMN_EOCUNKNOWNUNICASTSTORMTHRESHOLD_FLAG;
- }
+ if (LIBSPID_SUCCESS != libspid_eoc_wl_get_list (wl, &wl_cnt))
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_wl_get_list error\n");
+ return MFD_ERROR;
+ }
+
+
+ for (i = 0; i < wl_cnt; i ++)
+ {
+ if (rowreq_ctx->tbl_idx.eocBroadcastStormProtectionCNUIndex !=
+ atoi (wl[i].tei) - 2)
+ {
+ continue;
+ }
+ strcpy (storm.mac_addr, wl[i].mac_addr);
+ break;
+ }
+ if (i == wl_cnt)
+ {
+ snmp_log (LOG_ERR, "get a invaild tei\n");
+ return MFD_ERROR;
+ }
+
+ sprintf (storm.port_index, "%d",
+ rowreq_ctx->tbl_idx.eocBroadcastStormProtectionPortIndex);
+
+ sprintf (storm.bcast_protect_en, "%d",
+ rowreq_ctx->data.eocBroadcastStormProtectionEN);
+
+ sprintf (storm.bcast_thres_hold, "%d",
+ rowreq_ctx->data.eocBroadcastStormThreshold);
+
+ sprintf (storm.multi_protect_en, "%d",
+ rowreq_ctx->data.eocMulticastStormProtectionEN);
+
+ sprintf (storm.multi_thres_hold, "%d",
+ rowreq_ctx->data.eocMulticastStormThreshold);
+
+ sprintf (storm.unknow_protect_en, "%d",
+ rowreq_ctx->data.eocUnknownUnicastStormProtectionEN);
+
+ sprintf (storm.unknow_thres_hold, "%d",
+ rowreq_ctx->data.eocUnknownUnicastStormThreshold);
+
+ if (LIBSPID_SUCCESS !=
+ libspid_eoc_storm_set (storm.mac_addr, storm.port_index, &storm))
+ {
+ snmp_log (LOG_ERR, "libspid_eoc_storm_set error");
+ return MFD_ERROR;
}
/*
@@ -370,7 +396,7 @@ eocBroadcastStormProtectionTable_commit( eocBroadcastStormProtectionTable_rowreq
}
if (save_flags) {
- snmp_log(LOG_ERR, "unhandled columns (0x%x) in commit\n", save_flags);
+ snmp_log (LOG_ERR, "unhandled columns (0x%x) in commit\n", save_flags);
return MFD_ERROR;
}
@@ -410,7 +436,7 @@ eocBroadcastStormProtectionTable_undo_commit( eocBroadcastStormProtectionTable_r
* eg: if (rowreq_ctx->column_set_flags & COLUMN__FLAG) {}
*/
-
+
/*
* if we successfully un-commited this row, clear the dirty flag.
*/
@@ -464,12 +490,12 @@ eocBroadcastStormProtectionTable_undo_commit( eocBroadcastStormProtectionTable_r
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -486,14 +512,11 @@ eocBroadcastStormProtectionTable_undo_commit( eocBroadcastStormProtectionTable_r
int
eocBroadcastStormProtectionEN_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, u_long eocBroadcastStormProtectionEN_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormProtectionEN_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocBroadcastStormProtectionEN_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
-
- /*
- * TODO:441:o: |-> Check for valid eocBroadcastStormProtectionEN value.
- */
+ netsnmp_assert (NULL != rowreq_ctx);
return MFD_SUCCESS; /* eocBroadcastStormProtectionEN value not illegal */
} /* eocBroadcastStormProtectionEN_check_value */
@@ -588,7 +611,7 @@ eocBroadcastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
*/
rowreq_ctx->data.eocBroadcastStormProtectionEN = rowreq_ctx->undo->eocBroadcastStormProtectionEN;
-
+
return MFD_SUCCESS;
} /* eocBroadcastStormProtectionEN_undo */
@@ -628,12 +651,12 @@ eocBroadcastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -649,14 +672,19 @@ eocBroadcastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
int
eocBroadcastStormThreshold_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, long eocBroadcastStormThreshold_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocBroadcastStormThreshold_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocBroadcastStormThreshold_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
-
- /*
- * TODO:441:o: |-> Check for valid eocBroadcastStormThreshold value.
- */
+ netsnmp_assert (NULL != rowreq_ctx);
+
+ if ((eocBroadcastStormThreshold_val <
+ LIBSPID_EOC_STORM_BCAST_THRES_HOLD_MIN )||
+ (eocBroadcastStormThreshold_val >
+ LIBSPID_EOC_STORM_BCAST_THRES_HOLD_MAX))
+ {
+ return MFD_NOT_VALID_NOW;
+ }
return MFD_SUCCESS; /* eocBroadcastStormThreshold value not illegal */
} /* eocBroadcastStormThreshold_check_value */
@@ -751,7 +779,7 @@ eocBroadcastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
*/
rowreq_ctx->data.eocBroadcastStormThreshold = rowreq_ctx->undo->eocBroadcastStormThreshold;
-
+
return MFD_SUCCESS;
} /* eocBroadcastStormThreshold_undo */
@@ -792,12 +820,12 @@ eocBroadcastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -814,14 +842,13 @@ eocBroadcastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
int
eocMulticastStormProtectionEN_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, u_long eocMulticastStormProtectionEN_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocMulticastStormProtectionEN_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocMulticastStormProtectionEN_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
+
- /*
- * TODO:441:o: |-> Check for valid eocMulticastStormProtectionEN value.
- */
return MFD_SUCCESS; /* eocMulticastStormProtectionEN value not illegal */
} /* eocMulticastStormProtectionEN_check_value */
@@ -916,7 +943,7 @@ eocMulticastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
*/
rowreq_ctx->data.eocMulticastStormProtectionEN = rowreq_ctx->undo->eocMulticastStormProtectionEN;
-
+
return MFD_SUCCESS;
} /* eocMulticastStormProtectionEN_undo */
@@ -956,12 +983,12 @@ eocMulticastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -977,14 +1004,19 @@ eocMulticastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq_ctx
int
eocMulticastStormThreshold_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, long eocMulticastStormThreshold_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocMulticastStormThreshold_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocMulticastStormThreshold_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
-
- /*
- * TODO:441:o: |-> Check for valid eocMulticastStormThreshold value.
- */
+ netsnmp_assert (NULL != rowreq_ctx);
+
+ if ((eocMulticastStormThreshold_val <
+ LIBSPID_EOC_STORM_MULTI_THRES_HOLD_MIN )||
+ (eocMulticastStormThreshold_val >
+ LIBSPID_EOC_STORM_MULTI_THRES_HOLD_MAX))
+ {
+ return MFD_NOT_VALID_NOW;
+ }
return MFD_SUCCESS; /* eocMulticastStormThreshold value not illegal */
} /* eocMulticastStormThreshold_check_value */
@@ -1079,7 +1111,7 @@ eocMulticastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
*/
rowreq_ctx->data.eocMulticastStormThreshold = rowreq_ctx->undo->eocMulticastStormThreshold;
-
+
return MFD_SUCCESS;
} /* eocMulticastStormThreshold_undo */
@@ -1120,12 +1152,12 @@ eocMulticastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -1142,14 +1174,13 @@ eocMulticastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ctx *ro
int
eocUnknownUnicastStormProtectionEN_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, u_long eocUnknownUnicastStormProtectionEN_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocUnknownUnicastStormProtectionEN_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocUnknownUnicastStormProtectionEN_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
+ netsnmp_assert (NULL != rowreq_ctx);
+
- /*
- * TODO:441:o: |-> Check for valid eocUnknownUnicastStormProtectionEN value.
- */
return MFD_SUCCESS; /* eocUnknownUnicastStormProtectionEN value not illegal */
} /* eocUnknownUnicastStormProtectionEN_check_value */
@@ -1244,7 +1275,7 @@ eocUnknownUnicastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq
*/
rowreq_ctx->data.eocUnknownUnicastStormProtectionEN = rowreq_ctx->undo->eocUnknownUnicastStormProtectionEN;
-
+
return MFD_SUCCESS;
} /* eocUnknownUnicastStormProtectionEN_undo */
@@ -1284,12 +1315,12 @@ eocUnknownUnicastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq
* You should check that the requested change between the undo value and the
* new value is legal (ie, the transistion from one value to another
* is legal).
- *
+ *
*@note
* This check is only to determine if the new value
* is \b potentially valid. This is the first check of many, and
* is one of the simplest ones.
- *
+ *
*@note
* this is not the place to do any checks for values
* which depend on some other value in the mib. Those
@@ -1305,14 +1336,19 @@ eocUnknownUnicastStormProtectionEN_undo( eocBroadcastStormProtectionTable_rowreq
int
eocUnknownUnicastStormThreshold_check_value( eocBroadcastStormProtectionTable_rowreq_ctx *rowreq_ctx, long eocUnknownUnicastStormThreshold_val)
{
- DEBUGMSGTL(("verbose:eocBroadcastStormProtectionTable:eocUnknownUnicastStormThreshold_check_value","called\n"));
+ DEBUGMSGTL (("verbose:eocBroadcastStormProtectionTable:"
+ "eocUnknownUnicastStormThreshold_check_value", "called\n"));
/** should never get a NULL pointer */
- netsnmp_assert(NULL != rowreq_ctx);
-
- /*
- * TODO:441:o: |-> Check for valid eocUnknownUnicastStormThreshold value.
- */
+ netsnmp_assert (NULL != rowreq_ctx);
+
+ if ((eocUnknownUnicastStormThreshold_val <
+ LIBSPID_EOC_STORM_UNKNOW_THRES_HOLD_MIN )||
+ (eocUnknownUnicastStormThreshold_val >
+ LIBSPID_EOC_STORM_UNKNOW_THRES_HOLD_MAX))
+ {
+ return MFD_NOT_VALID_NOW;
+ }
return MFD_SUCCESS; /* eocUnknownUnicastStormThreshold value not illegal */
} /* eocUnknownUnicastStormThreshold_check_value */
@@ -1407,7 +1443,7 @@ eocUnknownUnicastStormThreshold_undo( eocBroadcastStormProtectionTable_rowreq_ct
*/
rowreq_ctx->data.eocUnknownUnicastStormThreshold = rowreq_ctx->undo->eocUnknownUnicastStormThreshold;
-
+
return MFD_SUCCESS;
} /* eocUnknownUnicastStormThreshold_undo */