This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from GuessWhoSamFoo/vio-2316
Determine MsgFlag based on auth and priv config
- Loading branch information
Showing
16 changed files
with
182 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,5 +25,5 @@ synse-snmp-plugin | |
dist/ | ||
|
||
#Local config for debugging real devices | ||
config.yaml | ||
config.yml | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
# This is the container running the Tripplite UPS SNMP emulator to test against. | ||
# This emulator runs on port 1025. | ||
snmp-emulator-tripplite-ups: | ||
container_name: snmp-emulator-tripplite-ups | ||
build: . | ||
dockerfile: Dockerfile | ||
# This command will override what is in the dockerfile. | ||
command: ./start_snmp_emulator.sh ./data 1025 snmp-emulator-triplite-ups.log V3 authPriv MD5 DES | ||
ports: | ||
- 1025:1025/udp | ||
version: "3" | ||
services: | ||
snmp-emulator-tripplite-ups: | ||
container_name: snmp-emulator-tripplite-ups | ||
build: . | ||
# This command will override what is in the dockerfile. | ||
command: ./start_snmp_emulator.sh ./data 1025 snmp-emulator-triplite-ups.log V3 authPriv MD5 DES | ||
ports: | ||
- 1025:1025/udp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package core | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gosnmp/gosnmp" | ||
) | ||
|
||
// CheckPrivacyAndAuthFromData determines a MsgFlag based on parsed data | ||
func (d *DeviceConfig) CheckPrivacyAndAuthFromData(data map[string]interface{}) error { | ||
auth, ok := data["authenticationProtocol"].(string) | ||
if !ok { | ||
return fmt.Errorf("cannot find authenticationProtocol") | ||
} | ||
priv, ok := data["privacyProtocol"].(string) | ||
if !ok { | ||
return fmt.Errorf("cannot find privacyProtocol") | ||
} | ||
|
||
switch { | ||
case auth == "None" && priv == "None": | ||
d.MsgFlag = gosnmp.NoAuthNoPriv | ||
case auth != "None" && priv == "None": | ||
d.MsgFlag = gosnmp.AuthNoPriv | ||
default: | ||
d.MsgFlag = gosnmp.AuthPriv | ||
} | ||
|
||
return nil | ||
} |
Oops, something went wrong.