How to use tuple in Yaml file

Viewed 751
pdu_cfg_new : {'stream':[(Ether,{'src':"00:50:56:ab:d5:ad",'dst':"00:50:56:ab:a2:e3"}), (IP,{'src':"192.168.1.2", 'dst':"10.1.12.1"}),(GRE, {'key':'48999'}),(Ether,{'src':"00:50:56:ab:d5:ad",'dst':"00:50:56:ab:a2:e3"}), (IP,{'src':"20.20.1.2", 'dst':"10.1.10.1"}),(TCP,{})], 'vm':[{'name':'ip_ttl','min_value':1,'max_value':125,'size':1,'op':'inc','offset':'IP.ttl'},{'name':'tcp_dport','min_value':1024,'max_value':1200,'size':2,'op':'inc','offset':'TCP.dport'}]}

This is my dictionary in yaml file , dictionary have some tuple value inside it but it looks like tuple is not supported in YAML, how can I configure this in my yaml file

1 Answers

According to PyYAML it can be represented as !!python/tuple, like:

stream:
- !!python/tuple
  - Ether
  - dst: 00:50:56:ab:a2:e3
    src: 00:50:56:ab:d5:ad
- !!python/tuple
  - IP
  - dst: 10.1.12.1
    src: 192.168.1.2
Related