Commit 992c7fc3 authored by Federico Sismondi's avatar Federico Sismondi

WoT testing tool UI adaptor sends a AgentStartInterface to all nodes, in order...

WoT testing tool UI adaptor sends a AgentStartInterface to all nodes, in order to get updated info on nodes in the VPN
parent 16c60719
Pipeline #3119 passed with stage
in 0 seconds
......@@ -19,6 +19,7 @@ from ioppytest.ui_adaptor.ui_tasks import (get_field_keys_from_ui_reply,
get_current_users_online,
get_field_keys_from_ui_request,
get_field_value_from_ui_reply)
from ioppytest.ui_adaptor.tt_tasks import bootstrap_all_tun_interfaces
from ioppytest.ui_adaptor.user_help_text import *
from ioppytest.ui_adaptor.message_rendering import list_to_str
......@@ -1903,26 +1904,7 @@ class WoTSessionMessageTranslator(CoAPSessionMessageTranslator):
ui_msg="Confirm that agent has been started as described below"
)
# BOOTSTRAP INTERFACES
send_start_test_suite_event()
disp = MsgUiDisplay(
tags=UI_TAG_AGENT_CONNECT,
fields=[{
"type": "p",
"value": "bootstrapping agent(s) interface.."
}, ]
)
amqp_connector.publish_ui_display(
message=disp,
user_id='all'
) # TODO some prettier solution for this maybe?
time.sleep(2)
# TEST AGENT
agents_kickstart_help = vpn_ping_tests
agents_kickstart_help = agents_kickstart_help.replace('AgentNameHost1', self.IUT_ROLES[0])
agents_kickstart_help = agents_kickstart_help.replace('AgentNameHost2', self.IUT_ROLES[1])
......@@ -1944,6 +1926,22 @@ class WoTSessionMessageTranslator(CoAPSessionMessageTranslator):
ui_tag=UI_TAG_AGENT_TEST,
)
# BOOTSTRAP INTERFACES
bootstrap_all_tun_interfaces(amqp_connector,self.vpn_agents)
disp = MsgUiDisplay(
tags=UI_TAG_AGENT_CONNECT,
fields=[{
"type": "p",
"value": "bootstrapping agent(s) interface.."
}, ]
)
amqp_connector.publish_ui_display(
message=disp,
user_id='all'
) # TODO some prettier solution for this maybe?
return True
def _send_vpn_table_to_gui(self, amqp_connector):
......
......@@ -4,6 +4,7 @@ import time
from ioppytest.ui_adaptor.ui_tasks import get_session_configuration_from_ui
from ioppytest.ui_adaptor import (AmqpSynchCallTimeoutError,
MsgSessionConfiguration,
MsgAgentTunStart,
SessionError,
MsgTestSuiteGetTestCases, )
......@@ -46,3 +47,28 @@ def wait_for_testing_tool_ready(amqp_publisher, max_retries=5):
if retries_left == 0:
raise SessionError("Couldn't detect Testing Tool up")
def bootstrap_all_tun_interfaces(amqp_publisher, vpn_table):
"""
Starts tun interface in user's agents.
Forces all agents to send current config they have already started their tun interfaces.
This is best effort approach, no exception is raised if the bootstrapping fails
"""
# vpn table is creates as { agent_name : (ipv6_prefix, ipv6_host, last_connection) , ...}
for agent_name, agent_info in vpn_table.items():
logging.info("starting/updating info for %s"%agent_name)
ipv6_network_prefix = str(agent_info[0])
ipv6_host = str(agent_info[1])
#assigned_ip = ":{}".format(ipv6_host)
msg = MsgAgentTunStart(
name=agent_name,
ipv6_prefix=ipv6_network_prefix,
ipv6_host=ipv6_host,
ipv6_no_forwarding=False,
)
msg.routing_key = msg.routing_key.replace('*', agent_name)
amqp_publisher.publish_message(msg)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment