WARNING! Gitlab maintenance operation scheduled for Thursday, 18 June between 19:00 and 20:00 (CET). During this time window, short service interruptions (less than 5 minutes) may occur. Thank you in advance for your understanding.
@@ -76,7 +76,7 @@ The Java client SDK is required to develop the backend of a MEC application usin
After the server stubs have been generated (see [Server stubs](#server-stubs)), the folder stucture will be something like the structure shown below:
```
meep-<MEC identifier>
meep-<mec-identifier>
|
\____ main.go
|
@@ -125,11 +125,11 @@ Steps to implement server side emulation logic:
3.**Create the service handler file**
Create a `server/<service-name>.go` file. This will contain all the handler functions for endpoints and the emulation logic for the service.
Create a `server/<mec-identifier>.go` file. This will contain all the handler functions for endpoints and the emulation logic for the service.
4.**Implement handler function for unsupported endpoints**
In the `server/api_unsupported.go` file (if it exists), for each of the handler functions, replace the previous code with `notImplemented(w, r)` and add this function in the `server/<service-name>.go` as follows:
In the `server/api_unsupported.go` file (if it exists), for each of the handler functions, replace the previous code with `notImplemented(w, r)` and add this function in the `server/<mec-identifier>.go` as follows:
@@ -140,26 +140,26 @@ Steps to implement server side emulation logic:
5.**Separate handler function(s) for the endpoints**
Remove the previous code in each of the `server/api_<api_tag>.go` file and replace it with a handler function. Implement all those handler functions in the `server/<service-name>.go` file.
Remove the previous code in each of the `server/api_<api_tag>.go` file and replace it with a handler function. Implement all those handler functions in the `server/<mec-identifier>.go` file.
6.**Implement SBI Communication Logic**
Create a `server/sbi` folder and create a `<service-name>.go` file in it. Implement all the communication and initialization related logic of SBI in this file.
The new MEC service will need to communicate with South Bound services to, for example, get updated scenario information. To do this, create a `server/sbi` folder and create a `<mec-identifier>-sbi.go` file in it. Implement all the communication and initialization related logic of SBI (South Bound Interface) in this file. This will include communication with the message queue and Redis cache from where it will obtain the necessary information.
Also, for the service to communicate with the SBI and pass parameters to and receive them from SBIs, implement that logic in the `server/<service-name>.go` file.
Instances of the necessary SBIs will then be created and their initilization triggering logic implmented in the `server/<mec-identifier>.go` file for the service to communicate with and receive information from them.
7.**Creating _go.mod_ and _go.sum_ files**
Run the following commands to create the _go.mod_ and _go.sum_ files:
```sh
go mod init github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<service-name>
go get github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<service-name>
go mod init github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<mec-identifier>
go get github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<mec-identifier>
```
After doing the above steps, the files will look something like the file/folder structure shown below:
```
meep-<MEC identifier>
meep-<mec-identifier>
|
\____ main.go
|
@@ -173,7 +173,7 @@ meep-<MEC identifier>
|
\____ sbi
| |
| \____ <service-name>.go
| \____ <mec-identifier>-sbi.go
|
\____ server
|
@@ -189,7 +189,7 @@ meep-<MEC identifier>
|
\____ routers.go
|
\____ <service-name>.go
\____ <mec-identifier>.go
```
### Client-side
@@ -206,7 +206,7 @@ The organization of the client code follow the AdvantEDGE usage. It is illustrat
```
go-packages
|
\____ meep-<MEC identifier>-client
\____ meep-<mec-identifier>-client
|
\____ .swagger-codegen
| |
@@ -233,7 +233,7 @@ go-packages
\____ README.md
```
The tag `<MEC identifier>` identifies the MEC API implemented by the micro-service. For instance, for the MEC-030 micro-service,the tag is 'vis'. The client microservice is named mee-vis-client.
The tag `<mec-identifier>` identifies the MEC API implemented by the micro-service. For instance, for the MEC-030 micro-service,the tag is 'vis'. The client microservice is named mee-vis-client.
There may be multiple files for `api_<api_tag>` and `model_<model_name>` depending on the tags and component schemas in the OAS file used to generate the server stubs.
@@ -243,7 +243,7 @@ Steps to implement server side emulation logic:
Rename the client package generated by [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) is a package named 'swagger'. This package name shall be renamed into 'client' using the following command:
@@ -260,15 +260,15 @@ Steps to implement server side emulation logic:
Run the following commands to create the _go.mod_ and _go.sum_ files:
```sh
go mod init github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-<MEC identifier>-client
go get github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<MEC identifier>-client
go mod init github.com/InterDigitalInc/AdvantEDGE/go-packages/meep-<mec-identifier>-client
go get github.com/InterDigitalInc/AdvantEDGE/go-apps/meep-<mec-identifier>-client
```
After doing the above steps, the files will look something like the file/folder structure shown below:
```
meep-<MEC identifier>
meep-<mec-identifier>
|
\____ api_<MEC identifier>.go
\____ api_<mec-identifier>.go
|
\____ client.go
|
@@ -292,7 +292,7 @@ meep-<MEC identifier>
|
\____ response.go
|
\____ <service-name>.go
\____ <mec-identifier>.go
```
## Unit tests for the new micro-service
@@ -302,11 +302,11 @@ The steps to achieve it are described below:
1.**Create a testing file**
Create a file named <service-name>_Test.go
Create a file named <mec-identifier>_Test.go
The files will look something like the file/folder structure shown below:
```
meep-<MEC identifier>
meep-<mec-identifier>
|
\____ ...
|
@@ -324,9 +324,9 @@ meep-<MEC identifier>
|
\____ routers.go
|
\____ <service-name>.go
\____ <mec-identifier>.go
|
\____ <service-name>_Test.go
\____ <mec-identifier>_Test.go
```
2.**Implement tests for unimplemented methods**
@@ -537,15 +537,15 @@ for file in /user-api/*; do
done
# Start service
exec /meep-<MEC identifier>
exec /meep-<mec-identifier>
```
**NOTE**: Replace `meep-<MEC identifier>` in the last line with the service name. For example, for V2X Information service, it will become `meep-vis`.
**NOTE**: Replace `meep-<mec-identifier>` in the last line with the service name. For example, for V2X Information service, it will become `meep-vis`.
The updated directory tree will look like this:
```
meep-<MEC identifier>
meep-<mec-identifier>
|
\____ main.go
|
@@ -563,7 +563,7 @@ meep-<MEC identifier>
|
\____ sbi
| |
| \____ <service-name>.go
| \____ <mec-identifier>.go
|
\____ server
|
@@ -579,7 +579,7 @@ meep-<MEC identifier>
|
\____ routers.go
|
\____ <service-name>.go
\____ <mec-identifier>.go
```
As a next step, code include in the directory structure above will be added into AdvantEDGE repository of fork. See [Code Integration](./backend-integration.md#code-integration) for more details.