Skip to content
Snippets Groups Projects
Commit 9dbffea8 authored by S.H.'s avatar S.H.
Browse files

better output and more instructions in README.md to test rtdt-manager

parent b1b68b98
No related branches found
No related tags found
No related merge requests found
Pipeline #270986 failed
......@@ -19,7 +19,6 @@ The application relies on building a local gnmi-target first based on the `inter
$ git clone git@code.fbi.h-da.de:danet/gnmi-target.git
$ git checkout interface-enabled-test
$ make all
```
The file under `yang/yang.go` was copied from the danet gnmi-target repo ([https://code.fbi.h-da.de/danet/gnmi-target](https://code.fbi.h-da.de/danet/gnmi-target)) after building it with `make all`.
It is necessary so that YANG paths received through events in the callback function can be parsed and their type can be extracted. This is the mechanism
......@@ -51,6 +50,12 @@ instances of RabbitMQ, MongoDB, etc.
The rtdt-manager subscribes to specific events in the physical network and a callback is triggered when these events occur. In this callback, the YANG path of the data that experienced a change
as well as the new value can be retrieved and are applied to the NDT.
Changes can be applied to the physical network using `gosdnc prompt` and then typing the following (with an example path for MTU):
```
> login --controller 172.100.0.5:55055 --p TestPassword --u admin
> networkElement path set <Choose a Target here> /interafces/interface[name=eth1]/config/mtu 2100 --force-push
```
Right now there are some bugs in the event system/controller. Changing the hostname works reliably (`/system/config/hostname`),
the interfaces handler in the gNMI-target often triggers many unwanted events, so it's dangerous to subscribe to `interfaces/`
on its own.
......
......@@ -489,7 +489,7 @@ func (r *RtdtManager) updateMNECallbackTwin(event *event.Event) {
}
func printEvent(event *event.Event) {
fmt.Println("\n")
fmt.Println("--------------------------------")
fmt.Println("---------- MNE EVENT -----------")
fmt.Println("EventID: ", event.ID.ID())
......@@ -506,6 +506,7 @@ func (r *RtdtManager) updateMNECallbackRealnet(event *event.Event) {
benchmark.Current = benchmark.Benchmark0{}
benchmark.Current.StartTimeRealnet = time.Now()
}
printEvent(event)
prefixInterface := "/interfaces/interface[name="
prefixHostname := "/system/config/hostname"
//realnetClabData := r.realnet.GetClabData()
......@@ -544,11 +545,11 @@ func (r *RtdtManager) updateMNECallbackRealnet(event *event.Event) {
// If experimental, just call it like this
if r.experimental {
fmt.Println("Found twin to apply change to:", r.rtdt_twins[0].Name)
fmt.Println("Found twin to apply change to:", r.rtdt_twins[0].Name)
twin.SetGnmiPath(path, value, twinEntityID, r.benchmark0)
// Else filter it first
} else if strings.HasPrefix(path, prefixInterface) && strings.HasSuffix(path, suffixMTU) {
fmt.Println("--- CHANGE MTU TRIGGERED ---")
fmt.Println("\nFound change we can apply: --- MTU ---")
printEvent(event)
fmt.Println("Value of new MTU: ", value)
......@@ -556,7 +557,7 @@ func (r *RtdtManager) updateMNECallbackRealnet(event *event.Event) {
// Set Hostname
} else if strings.HasPrefix(path, prefixHostname) {
fmt.Println("--- CHANGE HOSTNAME TRIGGERED ---")
fmt.Println("\nFound change we can apply: --- HOSTNAME ---")
printEvent(event)
for _, twin := range r.rtdt_twins {
if twin == nil {
......@@ -571,6 +572,7 @@ func (r *RtdtManager) updateMNECallbackRealnet(event *event.Event) {
}
}
} else if regexMatchOperStatus != nil && len(r.rtdt_twins) > 0 {
fmt.Println("\nFound change we can apply: --- INTERFACE UP/DOWN ---")
fmt.Println("Setting interface", regexMatchOperStatus[1], "UP/DOWN")
fmt.Printf("match: %v\n", regexMatchOperStatus)
path := "/interfaces/interface[name=" + regexMatchOperStatus[1] + "]/config/enabled"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment