Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding string value with embedded "'" fails #646

Closed
ghost opened this issue Dec 9, 2017 · 0 comments
Closed

Encoding string value with embedded "'" fails #646

ghost opened this issue Dec 9, 2017 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Dec 9, 2017

Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.

Expected Behavior

Encoding should work for valid value

Current Behavior

Error occurs

Steps to Reproduce

Run the script below

Your Script

from ydk.models.openconfig import openconfig_routing_policy \
    as oc_routing_policy                                                                                                                                                 
routing_policy = oc_routing_policy.RoutingPolicy()

com = oc_routing_policy.RoutingPolicy.DefinedSets.BgpDefinedSets.CommunitySets.CommunitySet()
com.community_set_name = "COMMUNITY-SET1"
com.config.community_set_name = "COMMUNITY-SET1"
com.config.community_member.append("ios-regex '65172:17...$'")
com.config.community_member.append("65172:16001")

com.state.community_set_name = "COMMUNITY-SET1"        
com.state.community_member.append("ios-regex '^65172:17...$'") 
com.state.community_member.append("65172:16001")  

routing_policy.defined_sets.bgp_defined_sets.community_sets.community_set.append(com)

codec.encode(provider, routing_policy)

Logs

Enable logging and post the logs below

In [5]: codec.encode(codec_p,routing_policy)
---------------------------------------------------------------------------
YPYModelError                             Traceback (most recent call last)
<ipython-input-5-2f16c043627d> in <module>()
----> 1 codec.encode(codec_p,routing_policy)

~/p/lib/python3.6/site-packages/ydk/errors/error_handler.py in helper(self, provider, entity, *args, **kwargs)
    110             err_msg = "'{0}' and '{1}' cannot be None".format(pname, ename)
    111             raise _YPYServiceError(error_msg=err_msg)
--> 112         return func(self, provider, entity, *args, **kwargs)
    113     return helper

~/p/lib/python3.6/site-packages/ydk/services/codec_service.py in encode(self, provider, entity_holder, pretty, subtree)
     72             return payload_map
     73         else:
---> 74             return self._encode(provider, entity_holder, pretty, subtree)
     75 
     76     def _encode(self, provider, entity, pretty, subtree):

~/p/lib/python3.6/site-packages/ydk/services/codec_service.py in _encode(self, provider, entity, pretty, subtree)
    103             result = codec_service.encode(data_node, provider.encoding, pretty)
    104             self.logger.debug("Performing encode operation, resulting in {}".format(result))
--> 105             return result
    106 
    107     @_check_argument

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)
     97                 value = type()
     98             try:
---> 99                 self.gen.throw(type, value, traceback)
    100             except StopIteration as exc:
    101                 # Suppress StopIteration *unless* it's the same exception that

~/p/lib/python3.6/site-packages/ydk/errors/error_handler.py in handle_runtime_error()
     80     finally:
     81         if _exc:
---> 82             _raise(_exc)
     83 
     84 

~/p/lib/python3.6/site-packages/ydk/errors/error_handler.py in _raise(exc)
     52     """
     53     if sys.version_info >= (3,3):
---> 54         exec("raise exc from None")
     55     else:
     56         raise exc

~/p/lib/python3.6/site-packages/ydk/errors/error_handler.py in <module>()

YPYModelError:  Unexpected character(s) '^' (^65172:17...$'']). Path: 

System Information

ydk 0.6.2

@ghost ghost added the bug label Dec 9, 2017
@ylil93 ylil93 closed this as completed in 7cbdeeb Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants