75 lines
1.6 KiB
Go
75 lines
1.6 KiB
Go
package snmp
|
|
|
|
import (
|
|
"net"
|
|
"testing"
|
|
|
|
omcc "git.loafle.net/overflow/model/config/credential"
|
|
omd "git.loafle.net/overflow/model/discovery"
|
|
omm "git.loafle.net/overflow/model/meta"
|
|
"git.loafle.net/overflow_scanner/probe/discovery/session"
|
|
"git.loafle.net/overflow_scanner/probe/discovery/types"
|
|
)
|
|
|
|
func TestScan(t *testing.T) {
|
|
s := session.NewMockDiscoverySession(
|
|
"testRequester",
|
|
types.DiscoveryRequestTypeHost,
|
|
&omd.Zone{
|
|
Network: "192.168.1.0/24",
|
|
Iface: "enp3s0",
|
|
MetaIPType: omm.ToMetaIPType(omm.MetaIPTypeEnumV4),
|
|
Address: "192.168.1.101",
|
|
Mac: "44:8a:5b:f1:f1:f3",
|
|
},
|
|
&omd.DiscoverHost{
|
|
MetaIPType: omm.ToMetaIPType(omm.MetaIPTypeEnumV4),
|
|
FirstScanRange: "192.168.1.1",
|
|
LastScanRange: "192.168.1.254",
|
|
DiscoveryConfig: &omd.DiscoveryConfig{},
|
|
},
|
|
)
|
|
|
|
type args struct {
|
|
discoverySession session.DiscoverySession
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
}{
|
|
{
|
|
name: "1",
|
|
args: args{
|
|
discoverySession: s,
|
|
},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
Scan(tt.args.discoverySession)
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_scanV2(t *testing.T) {
|
|
type args struct {
|
|
target net.IP
|
|
discoverySession session.DiscoverySession
|
|
credential *omcc.SNMPCredential
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want bool
|
|
}{
|
|
// TODO: Add test cases.
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := scanV2(tt.args.target, tt.args.discoverySession, tt.args.credential); got != tt.want {
|
|
t.Errorf("scanV2() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|