OpenIxia / IxNetwork

A central location for IxNetwork sample scripts and utilities. Please also visit http://openixia.com
MIT License
50 stars 59 forks source link

Cannot add protocol template that contains '(', ')' characters in its name to traffic item. #87

Closed Ethernet-Packet closed 4 years ago

Ethernet-Packet commented 4 years ago

From file \IxNetwork\RestApi\Python\Modules\IxNetRestApiTraffic.py the following function (keyword) addTrafficItemPacketStack throws "No such protocolTemplate name found: Connectivity Fault Management (CFM)" even though "Connectivity Fault Management (CFM)" is a valid protocol template name.

The reason behind the issue is the following regex:

if bool(re.match('^%s$' % protocolStackNameToAdd, eachProtocol['displayName'].strip(), re.I)):

in which the (, ) characters are not escaped, thus the regex won't match.

As a workaround the protocol template name should be escaped upon passing it to the addTrafficItemPacketStack function. E.g. in Robot Framework:

IxiaTraffic.Add Traffic Item Packet Stack    ${configEmelentsToModify}    Connectivity Fault Management \\(CFM\\)    1    append
hubertgee commented 4 years ago

Correct. You need to add backslashes.