Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add devices with multiple slots #393

Merged
merged 24 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3ca1ec1
feat(api) slot validation
helderbetiol Feb 5, 2024
1804cb2
feat(API) update `vector2`, `vector3` and `description` format on JSO…
Barbozafab Feb 7, 2024
1756577
feat(API) update API for new `vector2`, `vector3` and `description` f…
Barbozafab Feb 7, 2024
ff23988
feat(CLI) update CLI for new `vector2`, `vector3` and `description` f…
Barbozafab Feb 7, 2024
22d87ae
feat(api) validate slots
helderbetiol Feb 8, 2024
a1df32b
Merge branch 'main' into feat38-multi-slots-devices
helderbetiol Feb 8, 2024
a1b11de
feat(api) validate slot not in use
helderbetiol Feb 8, 2024
50ae2e9
feat(app) description as string, not array
helderbetiol Feb 8, 2024
849a291
Merge branch 'feat363-vector-format' into feat38-multi-slots-devices
helderbetiol Feb 8, 2024
76c5a42
feat(app) change +dv format
helderbetiol Feb 9, 2024
165bb5a
fix(cli,api) correct string format
helderbetiol Feb 13, 2024
303b4db
Merge branch 'main' into feat38-multi-slots-devices
helderbetiol Feb 13, 2024
efddacc
fix(api, cli) tests
helderbetiol Feb 13, 2024
2217bba
fix(api,cli) tests
helderbetiol Feb 13, 2024
4b884d3
doc(cli) update create device
helderbetiol Feb 14, 2024
fb098d2
fix(cli) update slot
helderbetiol Feb 14, 2024
587b52a
feat(cli) adapt link to multi slots
helderbetiol Feb 14, 2024
78d2556
Merge branch 'main' into feat38-multi-slots-devices
helderbetiol Feb 16, 2024
3970090
fix(api) slot: do not check self
helderbetiol Feb 19, 2024
b288ada
fix(cli) no more empty templates
helderbetiol Feb 19, 2024
ccf1298
feat(api) elemOrient format to vector3
helderbetiol Feb 20, 2024
ebf6fa5
Merge branch 'main' into multi-slots
helderbetiol Feb 23, 2024
22ba791
fix(api) tests
helderbetiol Feb 23, 2024
566b3d2
fix(cli) test fix
helderbetiol Feb 23, 2024
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
6 changes: 1 addition & 5 deletions API/controllers/entityController.go
Original file line number Diff line number Diff line change
Expand Up @@ -1847,11 +1847,7 @@ func LinkEntity(w http.ResponseWriter, r *http.Request) {
entityStr = data["category"].(string)
destSlot, bodyHasSlot := body["slot"]
if entityStr == "device" && bodyHasSlot {
if _, err := strconv.Atoi(destSlot); err == nil {
data["posU"] = destSlot
} else {
data["slot"] = destSlot
}
data["slot"] = destSlot
}
}
if newName != "" {
Expand Down
1 change: 0 additions & 1 deletion API/models/schemas/device_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"partNumber": "0303XXXX",
"size": "[388.4, 205.9]",
"sizeUnit": "mm",
"slot": "slot6",
"template": "huawei-xxxxxx",
"type": "blade",
"vendor": "Huawei",
Expand Down
37 changes: 10 additions & 27 deletions API/models/schemas/obj_template_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,13 @@
"$ref": "refs/types.json#/definitions/colorTemplate"
},
"elemOrient": {
"type": "string",
"enum": [
"horizontal",
"vertical",
""
]
"$ref": "#/$defs/elemVector"
},
"elemPos": {
"$ref": "#/$defs/elemPos"
"$ref": "#/$defs/elemVector"
},
"elemSize": {
"$ref": "#/$defs/elemSize"
"$ref": "#/$defs/elemVector"
},
"labelPos": {
"$ref": "#/$defs/labelPos"
Expand Down Expand Up @@ -146,11 +141,7 @@
],
"properties": {
"elemOrient": {
"type": "string",
"enum": [
"horizontal",
"vertical"
]
"$ref": "#/$defs/elemVector"
},
"attributes": {
"$ref": "#/$defs/attributes"
Expand All @@ -161,10 +152,10 @@
},

"elemPos": {
"$ref": "#/$defs/elemPos"
"$ref": "#/$defs/elemVector"
},
"elemSize": {
"$ref": "#/$defs/elemSize"
"$ref": "#/$defs/elemVector"
},
"labelPos": {
"$ref": "#/$defs/labelPos"
Expand All @@ -188,15 +179,7 @@
}
}
},
"elemPos": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 3,
"maxItems": 3
},
"elemSize": {
"elemVector": {
"type": "array",
"items": {
"type": "number"
Expand Down Expand Up @@ -235,7 +218,7 @@
{
"location": "eth2",
"type": "port",
"elemOrient": "",
"elemOrient": [1,2,3],
"elemPos": [104, 649, 0],
"elemSize": [14, 11, 11],
"mandatory": "yes",
Expand All @@ -250,7 +233,7 @@
{
"location": "cpu1",
"type": "processor",
"elemOrient": "horizontal",
"elemOrient": [0,0,0],
"elemPos": [68, 343, 0],
"elemSize": [97, 97, 30],
"mandatory": "yes",
Expand Down Expand Up @@ -278,7 +261,7 @@
{
"location": "u01",
"type": "u",
"elemOrient": "horizontal",
"elemOrient": [33.3,-44.4,107],
"elemPos": [58, 51, 44.45],
"elemSize": [482.6, 1138, 44.45],
"mandatory": "no",
Expand Down
2 changes: 1 addition & 1 deletion API/models/schemas/test_data/KO/device1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"partNumber": "0303XXXX",
"size": "[388.4, 205.9]",
"sizeUnit": "mm",
"slot": "slot6",
"slot": "[slot6]",
"type": "blade",
"vendor": "Huawei",
"weightKg": "1.81"
Expand Down
10 changes: 5 additions & 5 deletions API/models/schemas/test_data/KO/obj_template4.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
},
"colors" : [],
"components" : [
{ "location": "midplane", "type": "chassis", "elemOrient" : "", "elemPos" : [], "elemSize" : [450, 30,270], "labelPos" : "top", "color" : "FFFFFF", "attributes":{} },
{ "location": "fpc", "type": "mgmt", "elemOrient" : "banana", "elemPos" : [180, 0,90], "elemSize" : [40, 230, 90], "labelPos" : "rear", "color" : "color" },
{ "location": "midplane", "type": "chassis", "elemOrient" : [0,0,0], "elemPos" : [], "elemSize" : [450, 30,270], "labelPos" : "top", "color" : "FFFFFF", "attributes":{} },
{ "location": "fpc", "type": "mgmt", "elemOrient" : "", "elemPos" : [180, 0,90], "elemSize" : [40, 230, 90], "labelPos" : "rear", "color" : "color" },
{ "location": "psu01", "type": "power", "elemPos" : [225, 0, 0], "elemSize" : [45, 230, 90], "labelPos" : "rear", "color" : "EE82EE" },
{ "location": "fan02", "type": "fan", "elemOrient" : "", "elemPos" : [270,0,0], "elemSize" : [90, 115, 90], "labelPos" : "banana", "color" : "" }
{ "location": "fan02", "type": "fan", "elemOrient" : [180,270,90], "elemPos" : [270,0,0], "elemSize" : [90, 115, 90], "labelPos" : "banana", "color" : "" }
],

"slots" : [
{ "location": "blade01", "type": "blade", "elemOrient" : "banana", "elemPos" : [225,260, 0], "elemSize" : [225,660, 45], "labelPos" : "front" },
{ "location": "blade02", "type": "blade", "elemOrient" : "vertical", "elemPos" : [ 0,260, 0], "elemSize" : [225,660, 45], "labelPos" : "front" },
{ "location": "blade01", "type": "blade", "elemOrient" : [0,0,0], "elemPos" : [225,260, 0], "elemSize" : [225,660, 45], "labelPos" : "front" },
{ "location": "blade02", "type": "blade", "elemOrient" : [-90,-90,-90], "elemPos" : [ 0,260, 0], "elemSize" : [225,660, 45], "labelPos" : "front" },
{ "location": "blade03", "type": "blade", "elemOrient" : "horizontal", "elemPos" : [225,260,45], "elemSize" : [225,660, 45], "labelPos" : "front", "color" : "" }
]
,
Expand Down
4 changes: 2 additions & 2 deletions API/models/schemas/test_data/KO/obj_template5.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
],
"slots" : [
{ "location": "u01", "type": "u", "elemOrient": "banana", "elemPos": [58,51,44.45], "elemSize": [482.6,1138,44.45], "mandatory": "no", "labelPos": "frontrear", "color": "@color1"},
{ "location": "u02", "type": "u", "elemOrient": "", "elemPos": [58,51,1,2], "elemSize": [482.6,1138], "mandatory": "no", "labelPos": "frontrear", "color": "@color1"},
{ "location": "u02", "type": "u", "elemOrient": [0,0,0], "elemPos": [58,51,1,2], "elemSize": [482.6,1138], "mandatory": "no", "labelPos": "frontrear", "color": "@color1"},
{ "location": "u03", "type": "u", "elemPos": [58,51,133.35], "elemSize": [482.6,1138,44.45], "mandatory": "no", "labelPos": "banana", "color": "@color1"},
{ "location": "u04", "type": "u", "elemOrient": "horizontal", "elemPos": [58,51,177.8], "elemSize": [482.6,1138,44.45], "mandatory": "no", "labelPos": "frontrear", "color": "color1"}
{ "location": "u04", "type": "u", "elemOrient": [-1,-2,-3], "elemPos": [58,51,177.8], "elemSize": [482.6,1138,44.45], "mandatory": "no", "labelPos": "frontrear", "color": "color1"}
]
}
Loading
Loading