-
Notifications
You must be signed in to change notification settings - Fork 1
Description
The most complex part of the av-control-api as it stands is the database configuration. There is a lot of overhead that we've introduced from our early SQL migration as well as legacy configuration items would either no longer use, or thought we would need but don't. I think that it would make it much easier for other organizations to use and configure their systems if we take the time to simplify the configuration by removing unnecessary pieces.
I'll go through each of the databases and note all of the changes that could be made to each of them.
Buildings
There is zero useful info in the buildings database. Remove it.
Room Configurations
This is a notoriously confusing database. Its function is to make it possible to pick specific command evaluators for a given room. In practice, we have written command evaluators that will work in all cases, and just use the same room configuration in every single room. I think that removing this database and "baking" the command evaluators to run into the API itself would make the configuration much easier to understand - the theoretical loss in picking which command evaluators to use would require smarter command evaluators in some cases, which I think is a worthwhile tradeoff.
Rooms
- Remove the
configurationIDblock since it will no longer be needed with the removal of room configurations. - The name field can be removed; only the
_idfield should be used for identifiying the document. - Add a tags block - a map of string to
interface{}(string, bool, number, or object). If someone wants the ability to filter their rooms in some manner, you could do so with tags. We could add predetermined tags into the config tool (likenotesbelow) if we wanted specific tags to be filled out by the installers or support. - Remove
description.notescan be added totagsto match what it would be used for in the config tool.
{
"_id": "ASB-A343",
"designation": "production",
"tags": {
"notes": "- Has a light in the ceiling\n - Secret door behind the podium",
"capacity": 50,
"roomType": "MMC", // or podium, etc
"activeClassroom": true
}
}Device Types
- Remove the
descriptionfield - Remove the
display_namefield - Remove the
source,destination, andtagsfields - Remove
ports- it's only being used for our config tool right now - Remove
roles: Its functionality can be met throughcommands- e.g., if there is a command toGetBlank, then that should be reflected in the API response. To figure out which devices should be shown in the API response (rolesVideoOut,AudioIn, etc), we simply build the graph for both audio & video and know that the devices at the end of the graph are devices that should be in the response. - commands
- becomes a map of CommandID to an object that includes the following fields:
address: the full URL of request for the av-api to send- Should be written using template syntax, with the variable names matching what is "passed" to the driver interfaces
order: if multiple actions are generated at the same time, this defines the order they should be executed in. Iforderis missing, the command is placed after allorder'd commands
- remove
description - remove
microserviceobject - remove
endpointobject
- becomes a map of CommandID to an object that includes the following fields:
{
"_id": "Atlona6x2",
"commands": {
// this is a map because I can't think of a reason to have multiple of
// a specific command. If there is a reason, this can be and array
// of objects.
"ChangeInput": {
"address": "http://localhost:8026/{{.Address}}/output/{{.Output}}/input/{{.Input}}/6x2",
"order": 10
},
"InputStatus": {
"address": "http://localhost:8026/{{.Address}}/ouput/{{.Port}}/6x2",
"order": 10
}
}
}Devices
- Remove
display_name- this belongs in the UI configuration. - Remove
description.notescan be added intagslike in Rooms. - Change
type._idto just betypeID- it still maps back to a device type - Remove
roles- see the above reasons on device types. - Proxy remains the same
ports_idchanges to name- remove
friendly_name,description,source_device,destination_device - add
source- a bool indicating that the traffic "originates" from this device - add
type- a string indicating the type of "traffic" going to/from the port - add
endpoint- the ID of the device connected to the other side of the port
- Change
tagsto match Roomtags
{
"_id": "TNRB-240-SW1",
"address": "10.66.51.242", // or a hostname here
"typeID": "Atlona6x2",
"proxy": {
".*": "TNRB-240-CP1.byu.edu"
},
// we do have cases where multiple ports with the same name
// exist, so this should be an array - not a map
"ports": [
{
"name": "IN1",
"endpoint": "ITB-1101-VIA1",
"source": false,
"type": "video"
},
{
"_id": "OUT33",
"endpoint": "TNRB-240-D1",
"source": true,
"type": "video"
}
],
"tags": {
"notes": "Located in the ceiling in TNRB 250",
"color": "red",
"speed": 300,
"old": false
}
}UI Configuration
The database changes for UI Configuration will be addressed in a proposal in the UI repo
Making these changes will require updating the av-control-api command evaluators to use the new configuration objects, as well as any services that also use the configuration (via, shure, device-monitoring, BFF, etc). We would also want to write a script to go through items in the database and convert their existing data into this new format. I would expect this change to take my time and two students' time for around a month to get the core API and drivers updated. There would be additional time required to update SMEE depending on how far along we are with that tool, and some (around 1 sprint of time, one person) to update the BFF.
Please feel free to respond with any thoughts you have on how we can improve these changes.