Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions lib/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,60 @@ function constantsFactory (path) {
type: 'compute'
}
]
},
NodeRelations: {
/* There are two classes about the pair of relations:
* component: one node is a component of the other
* e.g. compute node vs. enclosure node
* expect behavior:
* the "By" in the relationType is used to tell component from its parent
* delete a node as well as its components;
* delete a component and update its parenet node
* link: two nodes is linked to each other
* e.g. compute node vs pdu node (TODO)
* expect behavior:
* delete one node and update the other
*/
encloses: {
mapping: 'enclosedBy',
relationClass: 'component'
},
enclosedBy: {
mapping: 'encloses',
relationClass: 'component'
},
/* Below are an example used to verify function
* currently used in unit test
compute node:
"relations": [
{
"relationType": "poweredBy",
"targets": [
"567b8f478b7444e407bb0729"
]
}
],
pdu node:
"relations": [
{
"relationType": "powers",
"targets": [
"567b8f478b7444e407bb072a"
"567b8f478b7444e407bb072b"
]
}
],
If either of them is removed, the other node will only be updated without deletion
*/
powers: {
mapping: 'poweredBy',
relationClass: 'link'
},
poweredBy: {
mapping: 'powers',
relationClass: 'link'
}
/* end example */
}
});

Expand Down