From b151662e97fd32fcd3336f947e7d2f22de58380e Mon Sep 17 00:00:00 2001 From: Peter Gubka Date: Tue, 14 Jun 2016 12:31:15 +0200 Subject: [PATCH] fixing play.py and data change counter -LOCAL_PREF is added into play.py to be sent -new xml and uri file added for data change counter usage in boron as new schema is present in boron Change-Id: I6b3179c4cdc82e97e0de557f2a484ee537527d12 Signed-off-by: Peter Gubka --- csit/libraries/ChangeCounter.robot | 4 +++- csit/libraries/ConfigViaRestconf.robot | 9 ++++++--- .../change_counter/{config.uri => config.uri.beryllium} | 0 csit/variables/bgpuser/change_counter/config.uri.boron | 1 + .../bgpuser/change_counter/config.uri.stable-lithium | 1 + csit/variables/bgpuser/change_counter/data.xml | 3 ++- csit/variables/bgpuser/change_counter/data.xml.beryllium | 9 +++++++++ .../bgpuser/change_counter/data.xml.stable-lithium | 9 +++++++++ tools/fastbgp/play.py | 6 ++++++ 9 files changed, 37 insertions(+), 5 deletions(-) rename csit/variables/bgpuser/change_counter/{config.uri => config.uri.beryllium} (100%) create mode 100644 csit/variables/bgpuser/change_counter/config.uri.boron create mode 100644 csit/variables/bgpuser/change_counter/config.uri.stable-lithium create mode 100644 csit/variables/bgpuser/change_counter/data.xml.beryllium create mode 100644 csit/variables/bgpuser/change_counter/data.xml.stable-lithium diff --git a/csit/libraries/ChangeCounter.robot b/csit/libraries/ChangeCounter.robot index 64a281b4af..2f02fc74d4 100644 --- a/csit/libraries/ChangeCounter.robot +++ b/csit/libraries/ChangeCounter.robot @@ -31,7 +31,9 @@ Get_Change_Count ${response} = RequestsLibrary.Get_Request operational data-change-counter:data-change-counter BuiltIn.Should_Be_Equal ${response.status_code} ${200} Got status: ${response.status_code} and message: ${response.text} # TODO: The following line can be insecure. Should we use regexp instead? - ${count} = BuiltIn.Evaluate ${response.text}["data-change-counter"]["count"] + # TODO: beware of new releases (carbon ...) and mind if more counters are used + ${count} = BuiltIn.Run Keyword If "${ODL_STREAM}" in ["beryllium", "stable-lithium"] BuiltIn.Evaluate ${response.text}["data-change-counter"]["count"] + ... ELSE BuiltIn.Evaluate ${response.text}["data-change-counter"]["counter"][0]["count"] [Return] ${count} Reconfigure_Topology_Name diff --git a/csit/libraries/ConfigViaRestconf.robot b/csit/libraries/ConfigViaRestconf.robot index 1c4649e134..8c78556e12 100644 --- a/csit/libraries/ConfigViaRestconf.robot +++ b/csit/libraries/ConfigViaRestconf.robot @@ -115,7 +115,8 @@ Delete_Xml_Template_Folder_Config_Via_Restconf Resolve_URI_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read URI template from folder, strip endline, make changes according to mapping, return the result. - ${uri_template}= OperatingSystem.Get_File ${folder}${/}config.uri + ${status} ${uri_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}config.uri.${ODL_STREAM} + ${uri_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}config.uri ELSE BuiltIn.Set Variable ${uri_template} BuiltIn.Log ${uri_template} ${uri_part}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${uri_template} ${mapping_as_string} [Return] ${uri_part} @@ -123,7 +124,8 @@ Resolve_URI_From_Template_Folder Resolve_Xml_Data_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read XML data template from folder, strip endline, make changes according to mapping, return the result. - ${data_template}= OperatingSystem.Get_File ${folder}${/}data.xml + ${status} ${data_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}data.xml.${ODL_STREAM} + ${data_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}data.xml ELSE BuiltIn.Set Variable ${data_template} BuiltIn.Log ${data_template} ${xml_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string} [Return] ${xml_data} @@ -131,7 +133,8 @@ Resolve_Xml_Data_From_Template_Folder Resolve_Json_Data_From_Template_Folder [Arguments] ${folder} ${mapping_as_string} [Documentation] Read JSON data template from folder, strip endline, make changes according to mapping, return the result. - ${data_template}= OperatingSystem.Get_File ${folder}${/}data.json + ${status} ${data_template}= BuiltIn.Run_Keyword_And_Ignore_Error OperatingSystem.Get_File ${folder}${/}data.json.${ODL_STREAM} + ${data_template}= BuiltIn.Run Keyword If '${status}' != 'PASS' OperatingSystem.Get_File ${folder}${/}data.json ELSE BuiltIn.Set Variable ${data_template} BuiltIn.Log ${data_template} ${json_data}= Strip_Endline_And_Apply_Substitutions_From_Mapping ${data_template} ${mapping_as_string} [Return] ${json_data} diff --git a/csit/variables/bgpuser/change_counter/config.uri b/csit/variables/bgpuser/change_counter/config.uri.beryllium similarity index 100% rename from csit/variables/bgpuser/change_counter/config.uri rename to csit/variables/bgpuser/change_counter/config.uri.beryllium diff --git a/csit/variables/bgpuser/change_counter/config.uri.boron b/csit/variables/bgpuser/change_counter/config.uri.boron new file mode 100644 index 0000000000..746ba0dde3 --- /dev/null +++ b/csit/variables/bgpuser/change_counter/config.uri.boron @@ -0,0 +1 @@ +config:modules/module/odl-data-change-counter-cfg:data-change-counter-impl/data-change-counter diff --git a/csit/variables/bgpuser/change_counter/config.uri.stable-lithium b/csit/variables/bgpuser/change_counter/config.uri.stable-lithium new file mode 100644 index 0000000000..065e6c2ecf --- /dev/null +++ b/csit/variables/bgpuser/change_counter/config.uri.stable-lithium @@ -0,0 +1 @@ +config:modules/module/odl-data-change-counter-cfg:data-change-counter-impl/data-change-counter-singleton diff --git a/csit/variables/bgpuser/change_counter/data.xml b/csit/variables/bgpuser/change_counter/data.xml index 1a9310070b..3bfead4216 100644 --- a/csit/variables/bgpuser/change_counter/data.xml +++ b/csit/variables/bgpuser/change_counter/data.xml @@ -1,6 +1,7 @@ prefix:data-change-counter-impl - data-change-counter-singleton + data-change-counter + data-change-counter binding:binding-async-data-broker pingpong-binding-data-broker diff --git a/csit/variables/bgpuser/change_counter/data.xml.beryllium b/csit/variables/bgpuser/change_counter/data.xml.beryllium new file mode 100644 index 0000000000..1a9310070b --- /dev/null +++ b/csit/variables/bgpuser/change_counter/data.xml.beryllium @@ -0,0 +1,9 @@ + + prefix:data-change-counter-impl + data-change-counter-singleton + + binding:binding-async-data-broker + pingpong-binding-data-broker + + $TOPOLOGY_NAME + diff --git a/csit/variables/bgpuser/change_counter/data.xml.stable-lithium b/csit/variables/bgpuser/change_counter/data.xml.stable-lithium new file mode 100644 index 0000000000..1a9310070b --- /dev/null +++ b/csit/variables/bgpuser/change_counter/data.xml.stable-lithium @@ -0,0 +1,9 @@ + + prefix:data-change-counter-impl + data-change-counter-singleton + + binding:binding-async-data-broker + pingpong-binding-data-broker + + $TOPOLOGY_NAME + diff --git a/tools/fastbgp/play.py b/tools/fastbgp/play.py index dfc4f0ef98..5dc84a1ba3 100755 --- a/tools/fastbgp/play.py +++ b/tools/fastbgp/play.py @@ -936,6 +936,12 @@ class MessageGenerator(object): path_attributes_hex += ( next_hop_hex # IP address of the next hop (4 bytes) ) + path_attributes_hex += ( + "\x40" # Flags ("Well-Known") + "\x05" # Type (LOCAL_PREF) + "\x04" # Length (4) + "\x00\x00\x00\x64" # (100) + ) if originator_id is not None: path_attributes_hex += ( "\x80" # Flags ("Optional, non-transitive") -- 2.36.6