Use json output in when getting intent ids
Change-Id: I6c0704cc67a424afdf0f1115e7a5b2a1cf0d5cf0
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index e9cf2b1..3a9a3c9 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2643,18 +2643,13 @@
"""
try:
# Obtain output of intents function
- intentsStr = self.intents(jsonFormat=False)
+ intentsStr = self.intents(jsonFormat=True)
+ # Convert to a dictionary
+ intents = json.loads( intentsStr )
intentIdList = []
-
- # Parse the intents output for ID's
- intentsList = [ s.strip() for s in intentsStr.splitlines() ]
- for intents in intentsList:
- match = re.search('id=0x([\da-f]+),', intents)
- if match:
- tmpId = match.group()[3:-1]
- intentIdList.append( tmpId )
+ for intent in intents:
+ intentIdList.append( intent[ 'id' ] )
return intentIdList
-
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
return None