Get Nodeb Design
1. Controller Layer
Add Route:
GET("/v1/nodeb/:ranName", controller.GetNodeb)Change name of requestController to nodebController:
controller := controllers.NewNodebController(logger, rmrService)
New Controller method:
func (rc RequestController) GetNodeb (writer http.ResponseWriter, request *http.Request, params httprouter.Params)
GetNb Business Logic
Code | Comment |
|---|---|
|
|
|
|
| OR |
|
|
| Convert the unmarshalled proto to JSON. Handle error |
|
|
| Respond with 200OK and responding node JSON representation. |
2. Entities
message RespondingNode{
ConnectionStatus connectionStatus = 1;
string ip = 2;
uint32 port = 3;
Node.Type nodeType = 4;
oneof Nodes{
ENB enb = 5;
GNB gnb = 6;
}
}
enum ConnectionStatus{
UNKNOWN_ConnectionStatus = 0;
Connected = 1;
NotConnected =2;
}
message Node{
enum Type {
UNKNOWN = 0;
ENB = 1;
GNB = 2;
}
}
3. RnibReader
New package: rnibReade
RnibReader interface {
GetNb(key string) (*RespondingNode, error)
}
// Get may also create an instancefunc GetRnibReader() RnibReader {
return pool.Get().(RnibReader)
}
Init RNIB instances pool (concern: separate the pool from rnibWriter layer)
GetNodeb Business Logic
Code | Comment |
|---|---|
|
|
|
|
| USE SDL to fetch data from REDIS. RETURNS: (map[string]interface{}, error) |
| Get the value of the requested key. This will be a byte array |
| Create a new pointer to the responding node |
| Unmarshal parses the protocol buffer representation in buf and places the decoded result in pb |
|
|
4. Sequence Diagram