Skip to content

Commit

Permalink
integration-tests: rework routing init to match interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
andrej committed Jan 11, 2023
1 parent 4a2e33d commit 87576eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 54 deletions.
36 changes: 34 additions & 2 deletions tests/integration/robot-ietf-routing/RoutingInit.resource
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ Library Process

*** Variables ***
${Xpath Routing} /ietf-routing:routing
${Running Datastore} running
${Plugin Timeout Seconds} 0.5s

*** Keywords ***
Restore Initial Running Datastore
Edit Datastore Config ${Connection Default} ${Session Running} ${Routing Init Running Str} json
Edit Datastore Config ${Connection Default} ${Session Running} ${Route Init Str} json
Check If Datastore Is Restored

Check If Datastore Is Restored
Expand All @@ -18,4 +20,34 @@ Check If Datastore Is Restored
... ${Session Running}
... ${Xpath Routing}
... json
Should Be Equal As Strings ${Restored} ${Routing Init Running Str} msg="failed to restore inital running datastore"
Should Be Equal As Strings ${Restored} ${Route Init Str} msg="failed to restore inital running datastore"

Init Running Session
${Session Running}= Open Datastore Session ${Connection Default} ${Running Datastore}
Set Global Variable ${Session Running}
${Route Init Str}= Get Datastore Data
... ${Connection Default}
... ${Session Running}
... ${Xpath Routing}
... json
Set Global Variable ${Route Init Str}
&{Route Init JSON}= Convert String To JSON ${Route Init Str}
Set Global Variable ${Route Init JSON}

Connect Routing
Start Plugin
${Connection Default}= Open Sysrepo Connection
Set Global Variable ${Connection Default}
Init Running Session

Cleanup Routing
Restore Initial Running Datastore
Stop Plugin

Start Plugin
${Plugin}= Start Process %{SYSREPO_ROUTING_PLUGIN_PATH}
Set Global Variable ${Plugin}
Wait For Process ${Plugin} timeout=${Plugin Timeout Seconds} on_timeout=continue

Stop Plugin
Terminate Process ${Plugin}
54 changes: 2 additions & 52 deletions tests/integration/robot-ietf-routing/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,7 @@ Library RPA.JSON
Library Process
Resource RoutingInit.resource

Suite Setup Setup IETF Routing
Suite Teardown Cleanup IETF Routing

Test Teardown Restore Initial Running Datastore

*** Variables ***
${Xpath Routing} /ietf-routing:routing
${Operational Datastore} operational
${Running Datastore} running


*** Keywords ***
Setup IETF Routing
[Documentation] Create a default connection and running and operational sessions
Start Plugin
${Connection Default}= Open Sysrepo Connection
Set Global Variable ${Connection Default}
Init Running Session
Init Operational Session

Start Plugin
${Plugin}= Start Process %{SYSREPO_ROUTING_PLUGIN_PATH}
Set Suite Variable ${Plugin}
Wait For Process ${Plugin} timeout=2s on_timeout=continue

Init Running Session
${Session Running}= Open Datastore Session ${Connection Default} ${Running Datastore}
Set Global Variable ${Session Running}
${Routing Init Running Str}= Get Datastore Data
... ${Connection Default}
... ${Session RUnning}
... ${Xpath Routing}
... json
Set Global Variable ${Routing Init Running Str}
&{Routing Init Running JSON}= Convert String To JSON ${Routing Init Running Str}
Set Global Variable ${Routing Init Running JSON}

Init Operational Session
${Session Operational}= Open Datastore Session ${Connection Default} ${Operational Datastore}
Set Global Variable ${Session Operational}
${Routing Init Operational Str}= Get Datastore Data
... ${Connection Default}
... ${Session Operational}
... ${Xpath Routing}
... json
Set Global Variable ${Routing Init Operational Str}
&{Routing Init Operational JSON}= Convert String To JSON ${Routing Init Operational Str}
Set Global Variable ${Routing Init Operational JSON}

Cleanup IETF Routing
[Documentation] Restore initial running datastore
Terminate Process ${Plugin}
Close All Sysrepo Connections And Sessions
Test Setup Connect Routing
Test Teardown Cleanup Routing

0 comments on commit 87576eb

Please sign in to comment.