"""
import re
-import xmlrpclib
+import xmlrpc.client
class BgpRpcClient(object):
def __init__(self, peer_addr, port=8000):
"""Setup destination point of the rpc server"""
- self.proxy = xmlrpclib.ServerProxy("http://{}:{}".format(peer_addr, port))
+ self.proxy = xmlrpc.client.ServerProxy("http://{}:{}".format(peer_addr, port))
def exa_announce(self, full_exabgp_cmd):
"""The full command to be passed to exabgp."""
def sum_hex_message(self, hex_string):
"""Verifies two hex messages are equal even in case, their arguments are misplaced.
Converts hex message arguments to integers and sums them up and returns the sum."""
- return sum(map(lambda x: int(x, 16), re.compile('[a-f\d]{2}').findall(hex_string[32:])))
+ return sum([int(x, 16) for x in re.compile('[a-f\d]{2}').findall(hex_string[32:])])
[Arguments] ${lower_bound} ${value_if_true} ${value_if_false}
[Documentation] Compare ${lower_bound} to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least ${lower_bound},
... return ${value_if_false} otherwise.
- BuiltIn.Run_Keyword_And_Return BuiltIn.Set_Variable_If &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}] ${value_if_true} ${value_if_false}
+ BuiltIn.Run_Keyword_And_Return BuiltIn.Set_Variable_If ${Stream_dict}[${ODL_STREAM}] >= ${Stream_dict}[${lower_bound}] ${value_if_true} ${value_if_false}
Set_Variable_If_At_Most
[Arguments] ${upper_bound} ${value_if_true} ${value_if_false}
[Documentation] Compare ${upper_bound} to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most ${upper_bound},
... return ${value_if_false} otherwise.
- BuiltIn.Run_Keyword_And_Return BuiltIn.Set_Variable_If &{Stream_dict}[${ODL_STREAM}] <= &{Stream_dict}[${upper_bound}] ${value_if_true} ${value_if_false}
+ BuiltIn.Run_Keyword_And_Return BuiltIn.Set_Variable_If ${Stream_dict}[${ODL_STREAM}] <= ${Stream_dict}[${upper_bound}] ${value_if_true} ${value_if_false}
Set_Variable_If_At_Least_Carbon
[Arguments] ${value_if_true} ${value_if_false}
[Arguments] ${lower_bound} ${kw_name} @{varargs} &{kwargs}
[Documentation] Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is at least ${lower_bound},
... run ${kw_name} @{varargs} &{kwargs} and return its value.
- BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
+ BuiltIn.Run_Keyword_And_Return_If ${Stream_dict}[${ODL_STREAM}] >= ${Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
Run_Keyword_If_At_Least_Else
[Arguments] ${lower_bound} @{varargs}
${varargs_else} Collections.Get_Slice_From_List ${varargs} ${position+1}
${args_if} ${kwargs_if} CompareStream__Convert_Input @{varargs_if}
${args_else} ${kwargs_else} CompareStream__Convert_Input @{varargs_else}
- ${resp} BuiltIn.Run_Keyword_If &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}] @{args_if} &{kwargs_if}
+ ${resp} BuiltIn.Run_Keyword_If ${Stream_dict}[${ODL_STREAM}] >= ${Stream_dict}[${lower_bound}] @{args_if} &{kwargs_if}
... ELSE @{args_else} &{kwargs_else}
[Return] ${resp}
[Arguments] ${upper_bound} ${kw_name} @{varargs} &{kwargs}
[Documentation] Compare ${upper_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is at most ${upper_bound},
... run ${kw_name} @{varargs} &{kwargs} and return its value.
- BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] <= &{Stream_dict}[${upper_bound}] ${kw_name} @{varargs} &{kwargs}
+ BuiltIn.Run_Keyword_And_Return_If ${Stream_dict}[${ODL_STREAM}] <= ${Stream_dict}[${upper_bound}] ${kw_name} @{varargs} &{kwargs}
Run_Keyword_If_At_Most_Else
[Arguments] ${upper_bound} @{varargs}
${varargs_else} Collections.Get_Slice_From_List ${varargs} ${position+1}
${args_if} ${kwargs_if} CompareStream__Convert_Input @{varargs_if}
${args_else} ${kwargs_else} CompareStream__Convert_Input @{varargs_else}
- ${resp} BuiltIn.Run_Keyword_If &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}] @{args_if} &{kwargs_if}
+ ${resp} BuiltIn.Run_Keyword_If ${Stream_dict}[${ODL_STREAM}] >= ${Stream_dict}[${lower_bound}] @{args_if} &{kwargs_if}
... ELSE @{args_else} &{kwargs_else}
[Return] ${resp}
[Arguments] ${lower_bound} ${kw_name} @{varargs} &{kwargs}
[Documentation] Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is more than ${lower_bound},
... run ${kw_name} @{varargs} &{kwargs} and return its value.
- BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] > &{Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
+ BuiltIn.Run_Keyword_And_Return_If ${Stream_dict}[${ODL_STREAM}] > ${Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
Run_Keyword_If_Equals
[Arguments] ${stream} ${kw_name} @{varargs} &{kwargs}
[Documentation] Compare ${stream} to ${ODL_STREAM} and in case ${ODL_STREAM} equals ${stream},
... run ${kw_name} @{varargs} &{kwargs} and return its value.
- BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] == &{Stream_dict}[${stream}] ${kw_name} @{varargs} &{kwargs}
+ BuiltIn.Run_Keyword_And_Return_If ${Stream_dict}[${ODL_STREAM}] == ${Stream_dict}[${stream}] ${kw_name} @{varargs} &{kwargs}
Run_Keyword_If_Equals_Else
[Arguments] ${stream} @{varargs}
${varargs_else} Collections.Get_Slice_From_List ${varargs} ${position+1}
${args_if} ${kwargs_if} CompareStream__Convert_Input @{varargs_if}
${args_else} ${kwargs_else} CompareStream__Convert_Input @{varargs_else}
- ${resp} BuiltIn.Run_Keyword_If &{Stream_dict}[${ODL_STREAM}] == &{Stream_dict}[${stream}] @{args_if} &{kwargs_if}
+ ${resp} BuiltIn.Run_Keyword_If ${Stream_dict}[${ODL_STREAM}] == ${Stream_dict}[${stream}] @{args_if} &{kwargs_if}
... ELSE @{args_else} &{kwargs_else}
[Return] ${resp}
[Arguments] ${lower_bound} ${kw_name} @{varargs} &{kwargs}
[Documentation] Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is less than ${lower_bound},
... run ${kw_name} @{varargs} &{kwargs} and return its value.
- BuiltIn.Run_Keyword_And_Return_If &{Stream_dict}[${ODL_STREAM}] < &{Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
+ BuiltIn.Run_Keyword_And_Return_If ${Stream_dict}[${ODL_STREAM}] < ${Stream_dict}[${lower_bound}] ${kw_name} @{varargs} &{kwargs}
Run_Keyword_If_At_Least_Carbon
[Arguments] ${kw_name} @{varargs} &{kwargs}
*** Settings ***
Documentation General Utils library. This library has broad scope, it can be used by any robot system tests.
Library SSHLibrary
-Library HttpLibrary.HTTP
Library String
Library DateTime
Library Process
def __init__(self, *args, **kwargs):
"""Put arguments to OrderedDict, sort, pass to super, cache values."""
self_unsorted = _collections.OrderedDict(*args, **kwargs)
- items_sorted = sorted(self_unsorted.items(), key=repr)
+ items_sorted = sorted(list(self_unsorted.items()), key=repr)
sup = super(_Hsfod, self) # possibly something else than OrderedDict
sup.__init__(items_sorted)
# Repr string is used for sorting, keys are more important than values.
- self.__repr = '{' + repr(self.keys()) + ':' + repr(self.values()) + '}'
+ self.__repr = '{' + repr(list(self.keys())) + ':' + repr(list(self.values())) + '}'
self.__hash = hash(self.__repr)
def __repr__(self):
TODO: Should this docstring include links to support dict and OrderedDict safety?
"""
if isinstance(obj, dict):
- for key, value in obj.iteritems():
+ for key, value in obj.items():
# Unicode is not str and vice versa, isinstance has to check for both.
# Luckily, "in" recognizes equivalent strings in different encodings.
# Type "bytes" is added for Python 3 compatibility.
- if key in keys_with_bits and isinstance(value, (unicode, str, bytes)):
+ if key in keys_with_bits and isinstance(value, (str, bytes)):
obj[key] = " ".join(sorted(value.split(" ")))
else:
sort_bits(value, keys_with_bits)
:return: corrected
"""
if isinstance(obj, dict):
- for key, value in obj.iteritems():
+ for key, value in obj.items():
# Unicode is not str and vice versa, isinstance has to check for both.
# Luckily, "in" recognizes equivalent strings in different encodings.
# Type "bytes" is added for Python 3 compatibility.
- if key in keys_with_volatiles and isinstance(value, (unicode, str, bytes, int, bool)):
+ if key in keys_with_volatiles and isinstance(value, (str, bytes, int, bool)):
obj[key] = "*"
else:
hide_volatile(value, keys_with_volatiles)
Resource ../../../libraries/RemoteBash.robot
Resource ../../../libraries/WaitForFailure.robot
Resource ../../../variables/Variables.robot
+Variables ../../../variables/tcpmd5user/variables.py ${TOOLS_SYSTEM_IP}
*** Variables ***
${DIR_WITH_TEMPLATES} ${CURDIR}/../../../variables/tcpmd5user/
${name}= NexusKeywords.Deploy_Test_Tool bgpcep pcep-pcc-mock
BuiltIn.Set_Suite_Variable ${filename} ${name}
#Setting Pcc Name and its code for mapping for templates
- BuiltIn.Set_Suite_Variable ${pcc_name} pcc_${TOOLS_SYSTEM_IP}_tunnel_1
- ${code}= Evaluate binascii.b2a_base64('${pcc_name}')[:-1] modules=binascii
- BuiltIn.Set_Suite_Variable ${pcc_name_code} ${code}
FailFast.Do_Not_Fail_Fast_From_Now_On
${ERROR_ARGS} = CompareStream.Set_Variable_If_At_Least_Neon ${NEW_ERROR_ARGS} ${OLD_ERROR_ARGS}
BuiltIn.Set_Suite_Variable ${ERROR_ARGS}
&{HEADERS_XML} Content-Type=application/xml # Content type for XML data. TODO: Hide into more specific Resource if possible.
${KARAF_PROMPT_LOGIN} opendaylight-user # This is used for karaf console login.
${ICMP_TYPE} 135
-${KARAF_DETAILED_PROMPT} @${ESCAPE_CHARACTER}[0m${ESCAPE_CHARACTER}[34mroot${ESCAPE_CHARACTER}[0m> # Larger substring of Karaf prompt, shorter ones may result in false positives.
+${KARAF_DETAILED_PROMPT} @${ESCAPE_CHARACTER}\[0m${ESCAPE_CHARACTER}\[34mroot${ESCAPE_CHARACTER}\[0m> # Larger substring of Karaf prompt, shorter ones may result in false positives.
${KARAF_HOME} ${WORKSPACE}${/}${BUNDLEFOLDER} # Karaf home directory path.
${KARAF_LOG} ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log # location of karaf.log in standard CSIT jobs
${KARAF_PASSWORD} karaf # Plaintext password to authenticate to Karaf console.
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
-import binascii
+import base64
from string import Template
"""Return dict of variables for the given IP address of Mininet VM."""
variables = {}
# 'V' style of explanation.
- # Comments analyze from high level, to low level, then code builds from low level back to high level.
+ # Comments a nalyze from high level, to low level, then code builds from low level back to high level.
# ### Pcep-topology JSON responses.
# Some testcases see only the tunnel created by pcc-mock start: "delegated tunnel" (ID 1).
# Other testcases see also tunnel created on ODL demand: "instatntiated tunnel" (ID 2).
# But as we need to plug the name to XML, let us try something more friendly:
instantiated_name = 'Instantiated tunnel' # the space is only somewhat evil character :)
# What is CODE? The NAME in base64 encoding (without endline):
- delegated_code = binascii.b2a_base64(delegated_name)[:-1] # remove endline added by the library function
- instantiated_code = binascii.b2a_base64(instantiated_name)[:-1]
+ delegated_name_bytes = delegated_name.encode('ascii')
+ delegated_code_encoded = base64.b64encode(delegated_name_bytes)
+ delegated_code = delegated_code_encoded.decode('ascii')
+ instantiated_name_bytes = instantiated_name.encode('ascii')
+ instantiated_code_encoded = base64.b64encode(instantiated_name_bytes)
+ instantiated_code = instantiated_code_encoded.decode('ascii')
+
# The remaining segment is HOPS, and that is the place where default and updated states differ.
# Once again, there is a template for a single hop:
hop_templ = Template('''
# terms of the Eclipse Public License v1.0 which accompanies this distribution,
# and is available at http://www.eclipse.org/legal/epl-v10.html
-import binascii
+import base64
from string import Template
# Given mininet_ip, this will be the sympolic name uf tunnel under test.
tunnelname = 'pcc_' + mininet_ip + '_tunnel_1'
# Base64 code for the symbolic name, as that is present in datastore.
- pathcode = binascii.b2a_base64(tunnelname)[:-1] # remove endline
+ tunnelname_bytes = tunnelname.encode('ascii')
+ pathcode_encoded = base64.b64encode(tunnelname_bytes)
+ pathcode = pathcode_encoded.decode('ascii')
+ variables['pcc_name'] = tunnelname
+ variables['pcc_name_code'] = pathcode
# JSON response when pcep-topology is ready but no PCC is connected.
variables['offjson'] = '''{
"topology": [
+elasticsearch
+elasticsearch_dsl
lfdocs-conf
+matplotlib
robotframework