SXP: Randomize retry open timers 03/63103/2
authorMartin Dindoffer <martin.dindoffer@pantheon.tech>
Wed, 13 Sep 2017 15:13:16 +0000 (17:13 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Wed, 13 Sep 2017 16:26:48 +0000 (16:26 +0000)
The SXP protocol does not cope well with nodes
running on the same IP. Nodes that try to connect
to each other at the same time will never do so.
Randomize the retry open timers to minimize such
false negatives to minimum.

Change-Id: I06c46bbfd3b93ee6f139619d8997b41e6f88922d
Signed-off-by: Martin Dindoffer <martin.dindoffer@pantheon.tech>
csit/libraries/Sxp.py
csit/libraries/SxpLib.robot

index 645d315663505bea4a4115b05755b2acd8ffcc29..5cd5a60726f4ecf28c6b5d3e698bc77542b7ae00 100644 (file)
@@ -898,7 +898,8 @@ def get_bindings_from_node_xml(ip, binding_range, domain_name):
     return data
 
 
-def add_node_xml(node_id, port, password, version, node_ip=None, expansion=0, bindings_timeout=0, keystores=None):
+def add_node_xml(node_id, port, password, version, node_ip=None, expansion=0, bindings_timeout=0, keystores=None,
+                 retry_open_timer=1):
     """Generate xml for Add Node request
 
     :param node_id: Ipv4 address formatted node id
@@ -944,7 +945,7 @@ def add_node_xml(node_id, port, password, version, node_ip=None, expansion=0, bi
     templ = Template('''<input xmlns="urn:opendaylight:sxp:controller">
     <node-id>$id</node-id>
     <timers>
-        <retry-open-time>1</retry-open-time>
+        <retry-open-time>$retry_open_timer</retry-open-time>
         <hold-time-min-acceptable>120</hold-time-min-acceptable>
         <delete-hold-down-time>$timeout</delete-hold-down-time>
         <hold-time-min>90</hold-time-min>
@@ -966,7 +967,8 @@ def add_node_xml(node_id, port, password, version, node_ip=None, expansion=0, bi
 </input>''')
     data = templ.substitute(
         {'ip': node_ip or node_id, 'id': node_id, 'port': port, 'password': password,
-         'version': version, 'expansion': expansion, 'timeout': bindings_timeout, 'tls': tls})
+         'version': version, 'expansion': expansion, 'timeout': bindings_timeout, 'tls': tls,
+         'retry_open_timer': retry_open_timer})
     return data
 
 
index 314cb55c659852f11bcf94506c7ec59e34e99340..7b7c3f921217a4058365ee21d0441009d23a42c4 100644 (file)
@@ -31,10 +31,10 @@ Post To Controller
 
 Add Node
     [Arguments]    ${node}    ${password}=${EMPTY}    ${version}=version4    ${port}=64999    ${session}=session    ${ip}=${EMPTY}
-    ...    ${ssl_stores}=${EMPTY}
+    ...    ${ssl_stores}=${EMPTY}    ${retry_open_timer}=1
     [Documentation]    Add node via RPC to ODL
     ${DATA}    Add Node Xml    ${node}    ${port}    ${password}    ${version}    ${ip}
-    ...    keystores=${ssl_stores}
+    ...    keystores=${ssl_stores}    retry_open_timer=${retry_open_timer}
     Post To Controller    ${session}    add-node    ${DATA}
 
 Delete Node
@@ -359,7 +359,8 @@ Setup SXP Environment
     Setup SXP Session
     : FOR    ${num}    IN RANGE    1    ${node_range}
     \    ${ip}    Get Ip From Number    ${num}
-    \    CompareStream.Run_Keyword_If_At_Least_Boron    Add Node    ${ip}
+    \    ${rnd_retry_time} =    Evaluate    random.randint(1, 10)    modules=random
+    \    CompareStream.Run_Keyword_If_At_Least_Boron    Add Node    ${ip}    retry_open_timer=${rnd_retry_time}
     \    CompareStream.Run_Keyword_If_At_Least_Boron    Wait Until Keyword Succeeds    20    1    Check Node Started    ${ip}
 
 Check Node Started