aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGokul Singaraju <gs244f@att.com>2018-06-13 16:32:20 -0400
committerGokul Singaraju <gs244f@att.com>2018-06-13 16:35:24 -0400
commit0444a4f2ddf9ba69de74af8c35b3c397db82db1b (patch)
tree424f9d737acac8e93fc8b6d45dc06f7d17ca7ac8
parent89b2a0184eae00344bfe9474339db3a69611c60b (diff)
Add json exception and VNF name
Issue-ID: DCAEGEN2-279 Change-Id: I3f78eb87ce4c6eaa30efa8d2efa1e3f187b4e7a7 Signed-off-by: Gokul Singaraju <gs244f@att.com>
-rwxr-xr-x[-rw-r--r--]miss_htbt_service/htbtworker.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/miss_htbt_service/htbtworker.py b/miss_htbt_service/htbtworker.py
index 347dbd6..6123386 100644..100755
--- a/miss_htbt_service/htbtworker.py
+++ b/miss_htbt_service/htbtworker.py
@@ -85,13 +85,18 @@ def periodic_event():
# Process the DMaaP input message retreived
for line in jlist:
print("Line:"+line)
- jobj = json.loads(line)
+ try:
+ jobj = json.loads(line)
+ except ValueError:
+ print('Decoding JSON has failed')
+ continue
#print(jobj)
- if( nfc != jobj['event']['commonEventHeader']['nfNamingCode']) :
- continue
srcid = (jobj['event']['commonEventHeader']['sourceId'])
lastepo = (jobj['event']['commonEventHeader']['lastEpochMicrosec'])
seqnum = (jobj['event']['commonEventHeader']['sequence'])
+ nfcode = (jobj['event']['commonEventHeader']['nfNamingCode'])
+ if( nfcode and nfc != nfcode):
+ continue
if( srcid in hearttrack ):
tdiff = lastepo - hearttrack[srcid]
sdiff = seqnum - heartstate[srcid]
@@ -197,6 +202,7 @@ def main(args):
cl_loop = args[7]
print ("Message router url %s " % mr_url)
print ("Policy router url %s " % pol_url)
+ print ("VNF %s " % nfc)
print ("Interval %s " % intvl)
if( cl_loop != "internal_test") :
#intvl = 60 # every second