Compare commits

..

36 Commits

Author SHA1 Message Date
pb
c413e0f494 Téléverser les fichiers vers "scripts/local_imgs" 2024-08-26 15:44:44 +02:00
pb
c4efdc8bd9 updated import name with 'deprecated-' 2024-07-29 18:02:29 +02:00
pb
e4b5b8a341 Updated package name declaration
In mod.go changed the first line to module cloud.o-forge.io/core/deprecated-oc-catalog
2024-07-29 17:52:36 +02:00
pb
4b03211502 Merge remote-tracking branch 'refs/remotes/origin/pierre_configuration' 2024-07-04 16:08:05 +02:00
pb
af691638da Merge branch 'feature/sort_links' 2024-07-04 16:04:19 +02:00
pb
b87b6c9eeb fixing scheduling process 2024-07-04 15:57:28 +02:00
pb
b40879d8aa documentation 2024-07-04 15:56:36 +02:00
pb
a1f04dc2f0 bugfix empty workflow 2024-04-25 15:48:32 +02:00
pb
9bd5be7758 Merge branch 'argo_workflow' 2024-04-16 18:54:05 +02:00
pb
97c09f4eef remove dead code 2024-04-16 18:49:49 +02:00
pb
9f4286cef5 corrected typo in dockerfile 2024-04-11 17:01:24 +02:00
pb
9ebd5cd5b0 Merge branch 'bugfix/settings_handling' 2024-04-11 16:46:22 +02:00
pb
8cdc8e6965 minor changes 2024-04-04 16:44:46 +02:00
pb
650fb92e39 fixed go.mod 2024-04-02 15:24:24 +02:00
pb
4c37053b9a decomment some code to allow build 2024-04-02 15:17:18 +02:00
pb
2c8110cea4 decomment some code to allow build 2024-04-02 14:49:11 +02:00
pb
6a489ee62f remove thumbs.db:encryptable 2024-04-02 11:54:33 +02:00
pb
c140a742b8 removed thumbs.db:encryptable 2024-04-02 11:53:10 +02:00
pb
7395c94dd1 minor changes 2024-03-29 17:58:52 +01:00
pb
655c9986f9 improved UML documentation 2024-03-29 17:55:38 +01:00
pb
95f0864bbb removed wrong logic from previous change 2024-03-29 17:53:48 +01:00
pb
10ec990a15 update the object stored for one workflow with user input 2024-03-29 17:00:53 +01:00
pb
1017f4404e Retrieve component from mxCell inside object tag 2024-03-28 14:43:33 +01:00
pb
dd360fd615 new doc and methods on models for user input
Merge remote-tracking branch 'origin/argo_workflow'
2024-03-22 11:28:04 +01:00
pb
e6c5b42c33 update 2024-02-19 17:57:06 +01:00
pb
20a2636677 Fixed router not working 2024-02-19 17:24:14 +01:00
pb
58d5493584 improved Dockerisation 2024-02-16 17:42:22 +01:00
pb
bd699aa0c9 added conf repertory to image 2024-02-15 18:04:55 +01:00
pb
4fcf84ce48 light dockerfile 2024-02-15 11:56:25 +01:00
pb
a1d3ddbbd0 corrected ports redirections in compose.backend 2024-02-15 11:49:44 +01:00
pb
7025c168ab Swagger returning only 404s 2024-02-15 11:03:32 +01:00
pb
a8d4e4bcf6 Modified DCName and DBPoint retrieving 2023-12-04 14:46:36 +01:00
pb
fdf1f20105 Solved the problem of generating swagger and minimal image (scratch) 2023-11-02 15:49:33 +01:00
pb
17f0998ffb Modified the conf loading process, now with onion in conf/conf.go 2023-10-31 11:23:39 +01:00
pb
1806624e76 Changed the conf object to the conf package for better accessibility 2023-10-31 10:30:01 +01:00
pb
31c7c44e2c started implementing a /ping route 2023-10-26 17:32:59 +02:00
35 changed files with 229 additions and 148 deletions

View File

@ -13,8 +13,8 @@ RUN bee generate routers
# Generating the swagger
RUN timeout 20 bee run -gendoc=true -downdoc=true -runmode=dev || :
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html && \
sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html
RUN sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html
RUN ls -l routers

View File

@ -31,6 +31,30 @@ const ui = SwaggerUIBundle({
This issue is fixed in the Dockerfile build with two `sed` to change the value of the swagger file URL.
## Deployment with Docker compose
## Running the app locally
In order to run the application we need to correct some errors that beego generates.
**Router generation**
Beego generates the routers from the comment of the controllers methods. However, there seems to be some errors when we let beego generate th routers from `bee run`.
We need to use `bee generate routers` to have a working router file.
**Swagger generation**
Using `bee run -downdoc=true -gendoc=true` beego download a swagger template and generate the JSON file (swagger.json) in `swagger/`. However the swagger template in `swagger/index.html` does not change the exemple's url for our current JSON file. When running locally we have to edit the call to construct the object holding the swagger information, with the parameter url set with the relative path to our JSON swagger file :
```
const ui = SwaggerUIBundle({
url: "swagger.json",
...
...
});
```
This issue is fixed in the Dockerfile build with two `sed` to change the value of the swagger file URL.
## Deployment with Docker compose
Deploy with docker:
@ -49,15 +73,18 @@ or out of docker `./scripts/populate_models.sh ./scripts/demo.json`
### Multinode
Deploy :
### Multinode
Deploy :
`docker-compose -f docker-compose.yml -f docker-compose.backend.yml -f docker-compose.multi.yml up --build`
## Populating the MongoDB database
From the root of the projet run :
On the machine running the mongoDB container, from the root of the project run this line :
`./scripts/multinode.sh ./scripts/demo.json`
`./scripts/populate_models.sh ./scripts/demo.json`
This script should be updated to be ran from anywhere.

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
)

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
"github.com/go-playground/validator/v10"

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
"github.com/go-playground/validator/v10"

View File

@ -3,7 +3,7 @@ package controllers
import (
"time"
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
)

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
)

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
)

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
)

View File

@ -3,7 +3,7 @@ package controllers
import (
"time"
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
"github.com/vk496/cron"

View File

@ -1,7 +1,7 @@
package controllers
import (
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
beego "github.com/beego/beego/v2/server/web"
)

54
docs/UML/mxgraph.puml Normal file
View File

@ -0,0 +1,54 @@
@startuml mxgraph
package MxGraph {
class MxGraphModel {
- XMLName xml.Name
+ Root : RootStruct
+ createLinks()
}
class RootStruct {
- XMLName xml.Name
- MxCell[] MxCell
- MxObject[] MxObject
- MxLink[] MxLink
}
class MxCell {
- XMLName xml.Name
+ ID string
+ RID *string
+ Rtype string
+ Parent *string
+ Edge *string
+ Source *string
+ Target *string
+ processLinks()
}
class MxLink {
+ ID string
+ Source string
+ Target string
}
class MxObject {
- XMLName xml.Name
+ ID string
+ Settings []xml.Attr
+ MxCell MxCell
}
class mxissue {
- msg string
+ Error() string
}
MxGraphModel *-- RootStruct : Root
RootStruct *-- MxCell : MxCell
RootStruct *-- MxObject : MxObject
RootStruct *-- MxLink : MxLink
MxObject *-- MxCell : MxCell
}
@enduml

View File

@ -0,0 +1,2 @@
@startuml
@enduml

View File

@ -0,0 +1,5 @@
For an easier parsing and constrution of dependencies we decided that :
- Computing elements must be linked between one another, to represent the chaining of events
- A storage component can be shared by several computing component, the direction of the arrow will determine if it's for writting or reading

2
go.mod
View File

@ -1,4 +1,4 @@
module cloud.o-forge.io/core/oc-catalog
module cloud.o-forge.io/core/deprecated-oc-catalog
go 1.15

View File

@ -3,9 +3,9 @@ package main
import (
"os"
"cloud.o-forge.io/core/oc-catalog/conf"
"cloud.o-forge.io/core/oc-catalog/routers"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/conf"
"cloud.o-forge.io/core/deprecated-oc-catalog/routers"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/logs"
beego "github.com/beego/beego/v2/server/web"

View File

@ -5,8 +5,8 @@ import (
"fmt"
"strings"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
structtomap "github.com/Klathmon/StructToMap"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson/primitive"

View File

@ -1,8 +1,8 @@
package models
import (
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson/primitive"
)

View File

@ -4,8 +4,8 @@ import (
"net"
"time"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson/primitive"
)

View File

@ -3,8 +3,8 @@ package models
import (
"errors"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"

View File

@ -1,7 +1,7 @@
package models
import (
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
)
type Link struct {
@ -49,7 +49,5 @@ func NewLink(src ResourceObject, srcId string, dst ResourceObject, dstId string)
return
}
// So far only computing components expect the ID of the DC in their attributes
// func (l *Link) AddLinkToDataCenter(component models.ComputingModel) {
// }

View File

@ -1,7 +1,7 @@
package rtype
import (
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/mongo"
)

View File

@ -4,7 +4,7 @@ import (
"errors"
"time"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"github.com/vk496/cron"
"go.mongodb.org/mongo-driver/bson/primitive"
@ -99,7 +99,7 @@ func CheckSchedule(cronString string, duration uint, cronFirstDate, cronLastDate
return errors.New("Bad cron message: " + err.Error())
}
dcModel := GetDatacenterFromAcronym(services.DC_NAME)
dcModel := GetDatacenterFromAcronym(services.DC_NAME)
if dcModel == nil {
return errors.New("The DC " + services.DC_NAME + " doesn't have any DC model with that acronym")
}

View File

@ -3,7 +3,7 @@ package models
import (
"strings"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson"

View File

@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson/primitive"
)

View File

@ -9,9 +9,9 @@ import (
"sort"
"time"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
swagger "cloud.o-forge.io/core/oc-catalog/selfapi"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
swagger "cloud.o-forge.io/core/deprecated-oc-catalog/selfapi"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"github.com/vk496/cron"
"go.mongodb.org/mongo-driver/bson/primitive"
@ -52,11 +52,11 @@ const SchedulesDB = "schedules"
type Workflow struct {
// The key of the map is the ID of the object itself
Data map[string]DataObject `json:"data"`
Computing map[string]ComputingObject `json:"computing"`
Storage map[string]StorageObject `json:"storage"`
Datacenter map[string]DatacenterObject `json:"datacenter"` //TODO: Decide if there should be multiple objects of a datacenter
Links map[string]Link `json:"link"`
Data map[string]DataObject `json:"data"`
Computing map[string]ComputingObject `json:"computing"`
Storage map[string]StorageObject `json:"storage"`
Datacenter map[string]DatacenterObject `json:"datacenter"` //TODO: Decide if there should be multiple objects of a datacenter
Links map[string]Link `json:"link"`
Schedules WorkflowSchedule `json:"schedules"`
@ -78,7 +78,7 @@ type ResourceObject interface {
// This type allows to process computing and storage component
// which can get input from the user
type EditableResourceObject interface{
type EditableResourceObject interface {
ResourceObject
addUserInput(map[string]interface{})
}
@ -119,13 +119,13 @@ func (w *Workflow) GetResource(rObjID *string) (retObj ResourceObject) {
return nil
}
if storVal, ok := w.Data[*rObjID]; ok {
retObj = &storVal
if datVal, ok := w.Data[*rObjID]; ok {
retObj = &datVal
return
}
if storVal, ok := w.Computing[*rObjID]; ok {
retObj = &storVal
if compVal, ok := w.Computing[*rObjID]; ok {
retObj = &compVal
return
}
@ -134,8 +134,8 @@ func (w *Workflow) GetResource(rObjID *string) (retObj ResourceObject) {
return
}
if storVal, ok := w.Datacenter[*rObjID]; ok {
retObj = &storVal
if dcVal, ok := w.Datacenter[*rObjID]; ok {
retObj = &dcVal
return
}
@ -182,7 +182,7 @@ func (w *Workflow) AddObj(robj ResourceObject) *primitive.ObjectID {
return &outputID
}
func (w *Workflow) AddLinkToWorkflow (link Link, id string){
func (w *Workflow) AddLinkToWorkflow(link Link, id string) {
if w.Links == nil {
w.Links = make(map[string]Link)
}
@ -547,7 +547,6 @@ func ParseMxGraph(username, workflowName, xmlData string) (err error, mxissues [
}
xmlModel.createLinks()
targetWorkspaceWorkflow, err, mxissues := userWorkspace.ConsumeMxGraphModel(xmlModel)
if err != nil {
@ -605,37 +604,38 @@ func (ws Workspace) ConsumeMxGraphModel(xmlmodel MxGraphModel) (returned_wf *Wor
return xmlmodel.Root.MxCell[i].RID != nil
})
// Create the object and add it to the appropriate list
// Create the object and add it to the appropriate list
// for all the components with setting, which are identified
// by a MxObject tag in the xml
for _, object := range *xmlmodel.Root.MxObject{
resObj, err, mxissues := returned_wf.mxCellToComponent(object.MxCell,ws)
if err != nil {
issues = append(issues, mxissues...)
}
// add the component to the worflow's attribute that stores
// all components in a map[string]Component where the key
// is the component's ID in the mxGraph and the value the Component object
returned_wf.UpdateObj(resObj,object.ID)
// Construct the object corresponding to the componant's type and use its addUserInput method
if(resObj.getRtype() == rtype.COMPUTING){
comp_obj := returned_wf.GetResource(&object.ID).(*ComputingObject)
comp_obj.AddUserInput(object.Settings)
returned_wf.UpdateObj(comp_obj,object.ID)
}
// if(resObj.getRtype() == rtype.DATA){
// }
}
if ok := xmlmodel.Root.MxObject != nil; ok {
for _, object := range *xmlmodel.Root.MxObject {
resObj, err, mxissues := returned_wf.mxCellToComponent(object.MxCell, ws)
if err != nil {
issues = append(issues, mxissues...)
}
// add the component to the worflow's attribute that stores
// all components in a map[string]Component where the key
// is the component's ID in the mxGraph and the value the Component object
returned_wf.UpdateObj(resObj, object.ID)
// Construct the object corresponding to the componant's type and use its addUserInput method
if resObj.getRtype() == rtype.COMPUTING {
comp_obj := returned_wf.GetResource(&object.ID).(*ComputingObject)
comp_obj.AddUserInput(object.Settings)
returned_wf.UpdateObj(comp_obj, object.ID)
}
// if(resObj.getRtype() == rtype.DATA){
// }
}
}
for _, cell := range xmlmodel.Root.MxCell {
switch {
case cell.RID != nil:
resObj, err, mxissues := returned_wf.mxCellToComponent(cell,ws)
resObj, err, mxissues := returned_wf.mxCellToComponent(cell, ws)
if err != nil {
issues = append(issues, mxissues...)
}
@ -674,12 +674,12 @@ func (ws Workspace) ConsumeMxGraphModel(xmlmodel MxGraphModel) (returned_wf *Wor
//
// The Source will be in the INPUTs of the Target.
// But we also must make sure that the Target will be in the OUTPUTs of the Source
}
}
issues = returned_wf.CreateLinks(xmlmodel.Root.MxLink, issues)
issues = returned_wf.CheckLinks(issues)
issues = returned_wf.createLinks(xmlmodel.Root.MxLink, issues)
issues = returned_wf.checkLinks(issues)
// dcslist := make(map[string]bool)
// dataslist := make(map[string]bool)
@ -833,14 +833,14 @@ func (ws Workspace) ConsumeMxGraphModel(xmlmodel MxGraphModel) (returned_wf *Wor
return
}
func (w *Workflow) CreateLinks(links []MxLink, issues []error) []error {
func (w *Workflow) createLinks(links []MxLink, issues []error) []error {
for _, link := range links {
if (len(link.Source) > 0 && len(link.Target) > 0){
sourceObj := w.GetResource(&link.Source)
targetObj := w.GetResource(&link.Target)
link_object := NewLink(sourceObj,link.Source, targetObj, link.Target)
w.AddLinkToWorkflow(link_object,link.ID)
link_object := NewLink(sourceObj, link.Source, targetObj, link.Target)
w.AddLinkToWorkflow(link_object, link.ID)
} else {
issues = append(issues, w.processLinkErrors(link))
}
@ -849,56 +849,55 @@ func (w *Workflow) CreateLinks(links []MxLink, issues []error) []error {
}
func (w *Workflow) processLinkErrors(link MxLink) (issue error) {
if len(link.Source) == 0 && len(link.Target) == 0 {
issue = errors.New("Arrow "+link.ID+" is alone")
} else if len(link.Source) == 0{
if len(link.Source) == 0 && len(link.Target) == 0 {
issue = errors.New("Arrow " + link.ID + " is alone")
} else if len(link.Source) == 0 {
targetObj := w.GetResource(&link.Target)
issue = errors.New("Arrow ("+link.ID+") to "+*targetObj.getName()+" without parent")
issue = errors.New("Arrow (" + link.ID + ") to " + *targetObj.getName() + " without parent")
} else {
sourceObj := w.GetResource(&link.Source)
issue = errors.New("Arrow "+link.ID+" from "+*sourceObj.getName()+" without target")
issue = errors.New("Arrow " + link.ID + " from " + *sourceObj.getName() + " without target")
}
return issue
}
func (w *Workflow) CheckLinks(issues []error) []error {
func (w *Workflow) checkLinks(issues []error) []error {
// Check that storage components have a valid link
for id, storage := range w.Storage {
if(!w.IsComponentSrc(id) && !w.IsComponentDst(id)){
if(!w.isComponentSrc(id) && !w.isComponentDst(id)){
issues = append(issues, errors.New("Storage "+*storage.getName()+" without compatible inputs and outputs"))
}
}
// Check that data components are linked to a computing component
for id, data := range w.Data {
if(!w.HasLinkageToComputing(id)){
if(!w.isLinkedToComputing(id)){
issues = append(issues, errors.New("Data "+*data.getName()+" not attached to any Computing"))
}
}
// Check that DC is linked to a computing component
for id, dc:= range w.Datacenter {
if(!w.HasLinkageToComputing(id)){
if(!w.isLinkedToComputing(id)){
issues = append(issues, errors.New("Datacenter "+*dc.getName()+" not attached to any Computing"))
}
}
// Check that all data computing components are linked to a DC
for id,comp:= range w.Computing {
if(!w.HasLinkageToDC(id)){
if(!w.isLinkedToDC(id)){
issues = append(issues, errors.New("Computing "+*comp.getName()+" not attached to any datacenter"))
}
}
}
return issues
}
func (w *Workflow) IsComponentSrc(id string) bool {
func (w *Workflow) isComponentSrc(id string) bool {
for _, link := range w.Links{
if(link.Source == id && link.Source != ""){
@ -909,7 +908,7 @@ func (w *Workflow) IsComponentSrc(id string) bool {
return false
}
func (w *Workflow) IsComponentDst(id string) bool {
func (w *Workflow) isComponentDst(id string) bool {
for _, link := range w.Links{
if(link.Destination == id && link.Source != ""){
@ -920,22 +919,22 @@ func (w *Workflow) IsComponentDst(id string) bool {
return false
}
func (w *Workflow) HasLinkageToComputing(id string) bool {
func (w *Workflow) isLinkedToComputing(id string) bool {
for idComputing, _ := range w.Computing {
if( (w.IsComponentSrc(id) && w.IsComponentDst(idComputing)) || (w.IsComponentSrc(idComputing) && w.IsComponentDst(id))){
if( (w.isComponentSrc(id) && w.isComponentDst(idComputing)) || (w.isComponentSrc(idComputing) && w.isComponentDst(id))){
return true
}
}
return false
}
func (w *Workflow) HasLinkageToDC(id string) bool {
func (w *Workflow) isLinkedToDC(id string) bool {
for _, link := range w.Links{
if(link.Source == id && link.DCLink){
for _, link := range w.Links {
if link.Source == id && link.DCLink {
return true
}
}
@ -1124,15 +1123,15 @@ func CheckAndBookWorkflowSchedule(username, workflowName string, book bool) (myR
SchedulesDB: &currentWorkflow.Schedules}},
)
if err != nil {
if err != nil {
logs.Critical("Internal error when updating in DB: " + err.Error())
}
return myRet, nil
}
// Not sure if this method handles error propagation well
func (wf Workflow) mxCellToComponent(cell MxCell, ws Workspace) (resObj ResourceObject,err error, issues []error){
// Not sure if this method handles error propagation well
func (wf Workflow) mxCellToComponent(cell MxCell, ws Workspace) (resObj ResourceObject, err error, issues []error) {
rType := ws.getRtype(*cell.RID)
if rType == rtype.INVALID {
@ -1151,22 +1150,7 @@ func (wf Workflow) mxCellToComponent(cell MxCell, ws Workspace) (resObj Resource
resObj = wf.CreateResourceObject(rType)
resObj.setReference(rIDObj)
return
}
// func (ws Workspace) extractMxCell(xmlModel MxGraphModel){
// // Iterate through all objects of the MxGraph
// graphObjects := xmlModel.Root.MxObject
// for _, object := range(*graphObjects){
// current_obj_id, _ := strconv.Atoi(object.ID)
// inside_cell_id := strconv.Itoa(current_obj_id + 1)
// cell := ws.GetResource(&inside_cell_id)
// // component := w.GetResource(cell.RID)
// fmt.Print(cell)
// }
// // Extract the mxCell object
// // Invoke the addParameter method from the component
// // Edit the ID to get the object's one
// }

View File

@ -4,8 +4,8 @@ import (
"context"
"errors"
"cloud.o-forge.io/core/oc-catalog/models/rtype"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/models/rtype"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 345 KiB

View File

@ -4,8 +4,8 @@ import (
"reflect"
"strings"
"cloud.o-forge.io/core/oc-catalog/controllers"
"cloud.o-forge.io/core/oc-catalog/models"
"cloud.o-forge.io/core/deprecated-oc-catalog/controllers"
"cloud.o-forge.io/core/deprecated-oc-catalog/models"
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/server/web/context"

View File

@ -12,8 +12,8 @@ import (
"os"
"strings"
"cloud.o-forge.io/core/oc-catalog/controllers"
"cloud.o-forge.io/core/oc-catalog/services"
"cloud.o-forge.io/core/deprecated-oc-catalog/controllers"
"cloud.o-forge.io/core/deprecated-oc-catalog/services"
"github.com/beego/beego/v2/core/logs"

View File

@ -236,6 +236,27 @@
},
"inputs": [],
"outputs": []
},
{
"name": "Mosquito server",
"short_description": "open source message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1.",
"logo": "./local_imgs/mosquitto-logo.png",
"description": "A very long description of what this storage is",
"type": "computing",
"owner": "IRT",
"price": 300,
"license": "GPLv2",
"execution_requirements": {
"cpus": 1,
"ram": 1024,
"storage": 300,
"gpus": 1,
"disk_io": "30 MB/s",
"parallel": true,
"scaling_model": 2
},
"inputs": [],
"outputs": []
}
]
},
@ -273,22 +294,6 @@
"inputs": [],
"outputs": [],
"URL" : ""
},
{
"name": "Mosquito server",
"short_description": "open source message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1.",
"logo": "./local_imgs/mosquitto-logo.png",
"description": "A very long description of what this storage is",
"type": "storage",
"DCacronym": "DC_myDC",
"size": 40000,
"encryption": false,
"redundancy": "RAID5S",
"throughput": "r:300,w:350",
"bookingPrice": 90,
"inputs": [],
"outputs": [],
"URL" : ""
}
]
},

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -3,7 +3,9 @@ package services
import (
"os"
SelfAPI "cloud.o-forge.io/core/oc-catalog/selfapi"
conf "cloud.o-forge.io/core/deprecated-oc-catalog/conf"
SelfAPI "cloud.o-forge.io/core/deprecated-oc-catalog/selfapi"
"github.com/beego/beego/v2/core/logs"
beego "github.com/beego/beego/v2/server/web"
)
@ -14,6 +16,7 @@ func GetSelfAPI(host string) *SelfAPI.APIClient {
return SelfAPI.NewAPIClient(&SelfAPI.Configuration{BasePath: "http://" + host + "/v1"})
}
// Need to understand why there are so many different DC name
func Discoveryinit() {
dcNameOS := os.Getenv("DOCKER_DCNAME")
@ -32,4 +35,7 @@ func Discoveryinit() {
DC_NAME = "DC_DEFAULT"
logs.Warning("Default DC name is used")
// Quickfix for scheduling
DC_NAME = conf.GetConfig().DCNAME
}

View File

@ -1,7 +1,7 @@
package services
import (
"cloud.o-forge.io/core/oc-catalog/conf"
"cloud.o-forge.io/core/deprecated-oc-catalog/conf"
)
func Init() {

View File

@ -4,7 +4,7 @@ import (
"context"
"time"
"cloud.o-forge.io/core/oc-catalog/conf"
"cloud.o-forge.io/core/deprecated-oc-catalog/conf"
"github.com/beego/beego/v2/core/logs"
"go.mongodb.org/mongo-driver/mongo"