API management
This section provides an overview of the requests (methods) used in the Fabric Services System REST API and provides basic examples.
Methods
The method defines the operation with a resource. The following methods are used in the Fabric Services System API:
- GET
- Retrieves a resource or set of resources
- POST
- Creates a resource or set of resources
- PUT
- Updates or replaces an existing resource or set of resources
- PATCH
- Updates one or more specific properties of an existing resource or set of resources
- DELETE
- Removes a resource or a set of resources
Working with the Swagger UI
The Swagger UI describes each service (resource) in the API.
Retrieving a resource
Use a GET
request to retrieve an object or group of objects. When you
use the UUID, the request returns a single object in JSON format; if you do not use a UUID,
the request returns a JSON list of objects.
Retrieve a list of fabric objects
curl --fail -s -X GET -H "Authorization: Bearer <ACCESS TOKEN>" -H "Content-Type: application/json; charset=utf-8" "https://fss.domain.tld/rest/intentmgr/api/v1/intents"
[
{
...
"fabric": [
{
"deployInfo": {
"isFailed": false,
"reason": "Delete Workload workload 1 Deployment Done.",
"timestamp": "2022-11-22T19:19:12Z",
"transactionId": "435561924323704832"
},
"isDigitalSandbox": false,
"name": "edge1_realnet_fabric",
"state": "DeploymentDone",
"uuid": "434325057192460288",
"version": "1.0"
}
],
...
"uuid": "434325057192329216",
"version": "1.0",
"wlCount": 0
},
{
...
"fabric": [
{
"deployInfo": {
"isFailed": false,
"reason": "Workload APP01 Deployment Done",
"timestamp": "2022-11-22T22:58:46Z",
"transactionId": "435584022265987072"
},
"isDigitalSandbox": true,
"name": "DSPOD01_gatenet_fabric",
"state": "DeploymentDone",
"uuid": "435562509898940416",
"version": "1.0"
}
],
...
"uuid": "435562509865320448",
"version": "1.0",
"wlCount": 0
}
]
Retrieve a single fabric with its UUID
curl --fail -s -X GET -H "Authorization: Bearer <ACCESS TOKEN>" -H "Content-Type: application/json; charset=utf-8" "https://fss.domain.tld/rest/intentmgr/api/v1/intents/434325057192329216"
{
...
"fabric": [
{
"deployInfo": {
"isFailed": false,
"reason": "Delete Workload workload 1 Deployment Done.",
"timestamp": "2022-11-22T19:19:12Z",
"transactionId": "435561924323704832"
},
"isDigitalSandbox": false,
"name": "edge1_realnet_fabric",
"state": "DeploymentDone",
"uuid": "434325057192460288",
"version": "1.0"
}
],
...
"uuid": "434325057192329216",
"version": "1.0",
"wlCount": 0
}
Create a resource
Use a POST
request to create a new resource or set of resources. When
you create a new object, you must provide a JSON object that contains all the attributes
of the object as defined in the API specifications.
Create a label
curl -X 'POST' \
'https://fss.domain.tld/rest/labelmgr/api/v1/labels' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <ACCESS TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"comments": "",
"defaultLabel": false,
"externalID": "",
"name": "Edge-Link",
"value": "edgelabel"
}'
{
"externalID": "",
"name": "Edge-Link",
"value": "edgelabel",
"comments": "",
"defaultLabel": false
}
Updating an object
Use a PUT
request to update an existing object.
Update a label
The following PUT
request updates the comments for a label:
curl -X 'PUT' \
'https://fss.domain.tld/rest/labelmgr/api/v1/labels' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <ACCESS TOKEN>' \
-H 'Content-Type: application/json' \
-d '{
"externalID": "",
"name": "Edge-Link",
"value": "edgelabel",
"comments": "Updated Comment",
"defaultLabel": false
}'
{
"externalID": "",
"name": "Edge-Link",
"value": "edgelabel",
"comments": "Updated Comment",
"defaultLabel": false
}
Deleting an object
Use a DELETE
request to remove an object or a set of objects.
DELETE requests
The followingDELETE
request removes minor severity
alarms:curl -X 'DELETE' \
'https://fss.domain.tld/rest/alarmmgr/api/v1/alarms?severity=minor' \
-H 'accept: application/json' -H 'Authorization: Bearer <ACCESS TOKEN>'
The
following DELETE
request removes an alarm with a UUID
424197038574403584:curl -X 'DELETE' \
'https://fss.domain.tld/rest/alarmmgr/api/v1/alarms/424197038574403584' \
-H 'accept: application/json' -H 'Authorization: Bearer <ACCESS TOKEN>'
Bulk API operations
A bulk API request is a single HTTPS request that contains multiple objects instead of a
single object. For example, a regular POST
requests contains the
definition of a single object and creates that object, and then returns the created
object. A bulk POST
request contains a list of objects (of the same
type and with the same hierarchy) where each object is handled individually and created;
the return contains a list of created objects instead of a single object.
Bulk API requests use the same URIs as for single object requests. If single object is received, it handles it as regular API call. If a list of objects is received, it handles it as a bulk API request.
Bulk API requests are supported for POST
, PUT
and
DELETE
bulk API calls.
Limitations
The maximum number of objects allowed for each bulk operation is as follows:
Operation | Number of objects |
---|---|
POST | 200 |
PUT | 200 |
DELETE | 150 |
Method | Endpoint | Details |
---|---|---|
POST/DELETE | /auth/api/{version}/users/:uuid/roles | add or remove role from user |
POST/DELETE | /auth/api/{version}/users/:uuid/usergroups | add or remove users from user-group |
POST/DELETE | /auth/api/{version}/usergroups/:uuid/users | associate or disassociate user from user-group |
POST | /intentmgr/api/{version}/intents/:uuid/fabrics/:fabricid/accept | accept, commit, or update diff |
POST and PUT requests
All POST
and PUT
endpoints that accept the JSON body
(object) to create or update an object also expose bulk POST
and bulk
PUT
endpoints.
Create a single region
POST http://fss.domain.tld/rest/intentmgr/api/v1/regions
{ /* single region object*/ }
Create multiple regions
POST http://fss.domain.tld/rest/intentmgr/api/v1/regions
[ { /* region1 object*/ }, { /* region2 object*/ }, { /* region3 object*/ } ]
Delete requests
DELETE
endpoints that accept the resource ID in the URI or accept the
JSON object as body (as identifier) also expose bulk DELETE
endpoints.
Delete devices identified by UUID
The following example deletes a single device by its UUID:DELETE http://fss.domain.tld/rest/inventory/api/v1/devices/{uuid}
The following example deletes multiple devices identified by their
UUIDs:DELETE http://fss.domain.tld/rest/inventory/api/v1/devices?uuid=1234&uuid=5678&uuid=4534
Delete objects by their labels
The following example deletes a single label identified by its name and value:DELETE http://fss.domain.tld/rest/labelmgr/api/v1/labels
{ "name": "Tenant", "value": "tenant1" }
DELETE http://fss.domain.tld/rest/labelmgr/api/v1/labels
[ { "name": "Tenant", "value": "tenant1" }, { "name": "tenant", "value": "tenant2" }, { "name": "tenant", "value": "tenant3" } ]
Bulk API response
A bulk API request can include the following response codes:
Code | Description |
---|---|
200 |
All actions were successful; information for each object is provided in the body |
207 |
Not all actions were successful; check the body for each object to identify the errors |
4XX |
Something is wrong with the entire bulk API request and it cannot be handled; this code is returned when incorrect formatting is used or when too many objects have been provided |
Response structure
The response structure allows for the easy handling of the response for each separate object; each object has a unique response. You can use the index in the response to map the response back to each object in the original request. The response also includes the overall status that lists how many actions were successful and how many failed.
{
"response": [
{
"status": $STATUS_CODE_FIRST_OBJECT,
"data": $RETURN_DATA_FIRST_OBJECT
},
{
"status": $STATUS_CODE_SECOND_OBJECT,
"data": $RETURN_DATA_SECOND_OBJECT
}
],
"responseMetadata": {
"success": $NUMBER_OF_SUCCESSFUL_OBJECTS,
"failure": $NUMBER_OF_FAILED_OBJECTS,
"total": $TOTAL_NUMBER_OF_OBJECTS
}
}
Variable | Description |
---|---|
$STATUS_CODE_*_OBJECT |
This variable specifies the HTTP response code that would be returned if a single object API request had been made with the specified action. For possible values, see Response codes. |
$RETURN_DATA_*_OBJECT |
This variable specifies the HTTP response data that would be returned if a single object API request had been made with the specified action. For instance, it contains the object's data if the creation succeeded or an error output if something went wrong for the object. |
$NUMBER_OF_SUCCESSFUL_OBJECTS |
This variable specifies for how many objects the action was successful. |
$NUMBER_OF_FAILED_OBJECTS |
This variable specifies for how many objects the action failed. |
$TOTAL_NUMBER_OF_OBJECTS |
This variable specifies the total number of objects provided.
This value is the sum of
$NUMBER_OF_SUCCESSFUL_OBJECTS and
$NUMBER_OF_FAILED_OBJECTS . |
Job manager framework
The Fabric Services System API job framework provides a way to handle REST API calls in a non-blocking manner so that the call returns to the invoking client immediately. The job manager manages the life cycle of a job.
- An API client sends a request.
- The job manager creates a new job, validates it, and marks its status as
Submitted
. - The new job is persisted in the Fabric Services System database.
- The job manager sends the client details about the accepted server operation in the form of a job with an ID, tracking URL, and other details.
Single auto-deploy command request body and response
The following examples show the request body that uses the auto-deploy command and the response from the system.{
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 123
},
{
"key": "intentVersion",
"value": "1.0"
}
]
}
{
"id": "443896864224313344",
"requestURI": "",
"requestMethod": "",
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 123,
"type": ""
},
{
"key": "intentVersion",
"value": "1.0",
"type": ""
}
],
"enqueueTime": "2023-01-19T07:19:09.096617184Z",
"endTime": null,
"trackingURL": "/jobs/443896864224313344",
"status": "Submitted",
"failureReason": "",
"result": null
}
Bulk API request and response
[
{
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 123
},
{
"key": "intentVersion",
"value": "1.0"
}
]
},
{
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 456
},
{
"key": "intentVersion",
"value": "2.0"
}
]
}
]
{
"response": [
{
"data": {
"id": "443896864224313344",
"requestURI": "",
"requestMethod": "",
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 123,
"type": ""
},
{
"key": "intentVersion",
"value": "1.0",
"type": ""
}
],
"enqueueTime": "2023-01-19T07:19:09.096617184Z",
"endTime": null,
"trackingURL": "/jobs/443896864224313344",
"status": "InProgress",
"failureReason": "",
"result": null
},
"status": 202
},
{
"data": {
"id": "443896864291422208",
"requestURI": "",
"requestMethod": "",
"command": "AUTO_DEPLOY",
"params": [
{
"key": "intentId",
"value": 456,
"type": ""
},
{
"key": "intentVersion",
"value": "2.0",
"type": ""
}
],
"enqueueTime": "2023-01-19T07:19:09.134867794Z",
"endTime": null,
"trackingURL": "/jobs/443896864291422208",
"status": "Submitted",
"failureReason": "",
"result": null
},
"status": 202
}
],
"responseMetadata": {
"success": 2,
"failure": 0,
"total": 2
}
}
Job retention
The system checks every hour for jobs that are older than 24 hours and purges them from the database to keep storage usage to a minimum.
Displaying inventory
The INVENTORY_UPDATE job command is used to gather and update information about all the hardware in a node.
INVENTORY_UPDATE
job
command, use the following API endpoints:- to display hardware details for a single node: http://fss.domain.tld/rest/inventory/api/v1/regions/{regionid}/pdevices/{node uuid}/hardwaredetails
- to display hardware details for a fabric intent: http://fss.domain.tld/rest/inventory/api/v1/inventory/api/v1/regions/{regionid}/intents/{fabric intent uuid}/pdeviceshardwaredetails
- The fabric intent must be successfully deployed and the planned node has been associated with real-world hardware.
- The nodes must be in the Ready state.
-
Create a job using INVENTORY_UPDATE command.
The endpoint is http://fss.domain.tld/rest/inventory/api/v1/jobs API.INVENTORY_UPDATE command request and response:
[ { "command": "INVENTORY_UPDATE", "params": [ { "key": "intentID", "value": "471251337657472994" // the fabric intent uuid } ] } ]
{ "response": [ { "data": { "regionID": "471251302223992802", "id": "471251417886119925", "requestURI": "", "requestMethod": "", "command": "INVENTORY_UPDATE", "params": [ { "key": "intentID", "value": "471251337657472994", "type": "" } ], "enqueueTime": "2023-07-27T00:22:13.638365301Z", "endTime": null, "trackingURL": "/regions/471251302223992802/jobs/471251417886119925", "status": "Submitted", "failureReason": "", "result": null }, "status": 202 } ], "responseMetadata": { "success": 1, "failure": 0, "total": 1 } }
Response when getting the latest state of the job, showing successful execution of the INVENTORY_UPDATE command:{ "regionID": "471251302223992802", "id": "471251971181926389", "requestURI": "", "requestMethod": "", "command": "INVENTORY_UPDATE", "params": [ { "key": "intentID", "value": "471251337657472994", "type": "" } ], "enqueueTime": "2023-07-27T00:27:43.42Z", "endTime": "2023-07-27T00:27:43.66Z", "trackingURL": "/regions/471251302223992802/jobs/471251971181926389", "status": "Success", "failureReason": "", "result": { "devicesFailed": "0", "devicesProcessed": "2", "devicesSucceeded": "2", "errors": [], "successList": [ "471251378744874970", "471251378845538266" ] } }
Response when getting the latest state of the job, showing partially successful execution of the INVENTORY_UPDATE command:{ "regionID": "471251302223992802", "id": "471252375965816821", "requestURI": "", "requestMethod": "", "command": "INVENTORY_UPDATE", "params": [ { "key": "intentID", "value": "471251313649276898", "type": "" } ], "enqueueTime": "2023-07-27T00:31:44.69Z", "endTime": "2023-07-27T00:31:44.877Z", "trackingURL": "/regions/471251302223992802/jobs/471252375965816821", "status": "Success", "failureReason": "", "result": { "devicesFailed": "2", "devicesProcessed": "4", "devicesSucceeded": "2", "errors": [ { "additional_info": null, "detail": "Device 471251331919730650 is not ready", "errors": null, "object_ref": "/inventory/api/v1/pdevices/471251331919730650/hardwaredetails", "status": 412, "title": "DEVICE_NOT_READY", "type": "/inventory/errors?key=device-not-ready" }, { "additional_info": null, "detail": "Device 471251329940019162 is not ready", "errors": null, "object_ref": "/inventory/api/v1/pdevices/471251329940019162/hardwaredetails", "status": 412, "title": "DEVICE_NOT_READY", "type": "/inventory/errors?key=device-not-ready" } ],
Response when getting the latest state of the job, showing failed execution of the INVENTORY_UPDATE command:{ "regionID": "471251302223992802", "id": "471251417886119925", "requestURI": "", "requestMethod": "", "command": "INVENTORY_UPDATE", "params": [ { "key": "intentID", "value": "123", "type": "" } ], "enqueueTime": "2023-07-27T00:22:13.638Z", "endTime": "2023-07-27T00:22:13.736Z", "trackingURL": "/regions/471251302223992802/jobs/471251417886119925", "status": "Fail", "failureReason": "did not have intent for 123", "result": null }
-
Display hardware details.
Device and component inventory by fabric intent - sample request and response
curl -X 'GET' \ 'https://fsp.nokia.com:8090/rest/inventory/api/v1/regions/471251302223992802/intents/471251337657472994/pdeviceshardwaredetails' \ -H 'accept: application/json' \ -H 'Authorization: NokiaFss1!'
Device and component inventory by planned node UUID - sample request and response'https://fsp.nokia.com:8090/rest/inventory/api/v1/regions/471251302223992802/pdevices/471251337657472994/hardwaredetails' \ -H 'accept: application/json' \ -H 'Authorization: NokiaFss1!'
{ "data": { "system": { "name": { "host-name": "fssi468972054851374514-020003ff0000-665b644676-dzxzk" }, "information": { "description": "SRLinux-v22.11.1-184-g6eeaa254f7 7250 IXR-6 Copyright (c) 2000-2020 Nokia. Kernel 4.18.0-425.3.1.el8.x86_64 #1 SMP Wed Nov 9 20:13:27 UTC 2022", "version": "v22.11.1-184-g6eeaa254f7" } }, "platform": { "chassis": { "clei-code": "Sim CLEI", "hw-mac-address": "02:00:03:FF:00:00", "manufactured-date": "01012019", "part-number": "Sim Part No.", "serial-number": "Sim Serial No.", "type": "" }, "control": { "A": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "slot": "A", "software-version": "", "type": "cpm2-ixr" }, "B": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "slot": "B", "software-version": "", "type": "" } }, "fabric": null, "fan-tray": { "1": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 1 }, "2": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 2 }, "3": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 3 } }, "linecard": { "1": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "software-version": "", "type": "", "slot": 1 }, "2": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "software-version": "", "type": "", "slot": 2 }, "3": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "software-version": "", "type": "", "slot": 3 }, "4": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "software-version": "", "type": "", "slot": 4 } }, "power-supply": { "1": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 1 }, "2": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 2 }, "3": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 3 }, "4": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 4 }, "5": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 5 }, "6": { "clei-code": "", "manufactured-date": "", "part-number": "", "serial-number": "", "type": "", "id": 6 } } }, "interface": null }, "lastUpdated": "2023-07-11T16:22:24Z", "name": "ds2-spine-1", "mgmtAddress": "31.107.200.68", "serialNumber": "468972119493987729", "uuid": "468972119493987729", "softwareVersion": "22.11.1-184"