Skip to content

Commit

Permalink
test: correct test
Browse files Browse the repository at this point in the history
  • Loading branch information
rfaircloth-splunk committed Oct 21, 2021
1 parent 7afeed1 commit 7b427f1
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions tests/test_ubiquiti_unifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,36 +111,36 @@ def test_ubiquiti_unifi_ap_u7pg2(
assert resultCount == 1


# # <30>Nov 10 11:49:46 U7PG2,788a2056b181,v4.0.66.10832: logread[5495]: Logread connected to 10.2.0.9:514
# def test_ubiquiti_unifi_ap_u7pg2_alt(
# record_property, setup_wordlist, setup_splunk, setup_sc4s
# ):
# host = "{}-{}".format(random.choice(setup_wordlist), random.choice(setup_wordlist))
# <30>Nov 10 11:49:46 U7PG2,788a2056b181,v4.0.66.10832: logread[5495]: Logread connected to 10.2.0.9:514
def test_ubiquiti_unifi_ap_u7pg2_alt(
record_property, setup_wordlist, setup_splunk, setup_sc4s
):
host = "{}-{}".format(random.choice(setup_wordlist), random.choice(setup_wordlist))

# dt = datetime.datetime.now()
# iso, bsd, time, date, tzoffset, tzname, epoch = time_operations(dt)
dt = datetime.datetime.now()
iso, bsd, time, date, tzoffset, tzname, epoch = time_operations(dt)

# # Tune time functions
# epoch = epoch[:-7]
# Tune time functions
epoch = epoch[:-7]

# mt = env.from_string(
# "{{mark}}{{ bsd }} 788a2056b183,v4.0.66.10832: logread[5495]: Logread connected to 10.2.0.9:514 {{ host }}"
# )
# message = mt.render(mark="<27>", bsd=bsd, host=host)
# sendsingle(message, setup_sc4s[0], setup_sc4s[1][514])
mt = env.from_string(
"{{mark}}{{ bsd }} 788a2056b183,v4.0.66.10832: logread[5495]: Logread connected to 10.2.0.9:514 {{ host }}"
)
message = mt.render(mark="<27>", bsd=bsd, host=host)
sendsingle(message, setup_sc4s[0], setup_sc4s[1][514])

# st = env.from_string(
# 'search _time={{ epoch }} index=netops sourcetype=ubnt NOT host=U7PG2 NOT host={{ host }} 788a2056b183 "{{ host }}"'
# )
# search = st.render(epoch=epoch)
st = env.from_string(
'search _time={{ epoch }} index=netops sourcetype=ubnt NOT host=U7PG2 NOT host={{ host }} 788a2056b183 "{{ host }}"'
)
search = st.render(epoch=epoch, host=host)

# resultCount, eventCount = splunk_single(setup_splunk, search)
resultCount, eventCount = splunk_single(setup_splunk, search)

# record_property("host", host)
# record_property("resultCount", resultCount)
# record_property("message", message)
record_property("host", host)
record_property("resultCount", resultCount)
record_property("message", message)

# assert resultCount == 1
assert resultCount == 1


# <4>Nov 10 23:04:06 USG kernel: [LAN_LOCAL-default-A]IN=eth0.2004 OUT= MAC= SRC=10.254.3.1 DST=224.0.0.251 LEN=348 TOS=0x00 PREC=0x00 TTL=255 ID=32463 DF PROTO=UDP SPT=5353 DPT=5353 LEN=328
Expand Down

0 comments on commit 7b427f1

Please sign in to comment.