-
Type: Bug
-
Status: Closed (View Workflow)
-
Priority: Minor
-
Resolution: Done
-
Affects Version/s: 1.0.0, 1.1.0, 1.2.0
-
Fix Version/s: 1.3.0
-
Component/s: None
-
Labels:None
-
Epic Link:
-
Sprint:Drake Sprint 1 (7/6-7/24)
Not sure if this is a bug or a feature
When accessing the intent info using the REST API, I get a JSON stream that looks like this.
http://10.128.103.1:8181/onos/v1/intents/29/14
{
"type": "OpticalConnectivityIntent",
"id": "0xe",
"appId": "DefaultApplicationId
"details": "OpticalConnectivityIntent{id=0xe, key=0xe, appId=DefaultApplicationId{id=29, name=org.onosproject.net.intent}
, priority=100, resources=[], src=ConnectPoint
{elementId=fjdwdmtl1:onos9500-1, portNumber=1-3-E1_LPORT}, dst=ConnectPoint
{elementId=fjdwdmtl1:onos9500-2, portNumber=1-3-E1_LPORT}, signalType=ODU4, isBidirectional=false}",
"resources": [],
"state": "INSTALLED"
}
For instance, the value for the appId key, is:
"appId": "DefaultApplicationId
"
To get the actual id, I need to do string pattern matching / parsing.
Python example:
p = re.search('id=(\d+),', str(intent))
app_id = int(p.group(1))
IMO, this sucks and goes against why we're using JSON.
The right way to return the appId is:
"appId" :