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

CONFIG_DB is not in sync with APP_DB when adding NAT_BINDINGS entries #1309

Closed
jciesiex opened this issue Jun 3, 2020 · 2 comments
Closed
Labels

Comments

@jciesiex
Copy link

jciesiex commented Jun 3, 2020

Steps to reproduce:

sudo config nat feature enable

echo '{"NAT_POOL": {"test_pool": {"nat_ip": "10.0.0.34","nat_port": "8000-9000"}},

"ACL_TABLE": {"test_acl": {"stage": "INGRESS","type": "L3","policy_desc": "test_policy","ports": ["Ethernet68"]}},

"NAT_BINDINGS": {"test_binding": {"access_list": "test_acl","nat_pool": "test_pool"}}}' > dynamic.json

sonic-cfggen -j dynamic.json --write-to-db

redis-dump -d 4 --pretty -k BINDING
redis-dump -d 0 --pretty -k BINDING
Observed behavior:

CONFIG_DB
{
"NAT_BINDINGS|test_binding": {
"type": "hash",
"value": {
"access_list": "test_acl",
"nat_pool": "test_pool"
}
}
}

APP_DB
no entries found

Expected behavior:
CONFIG_DB and APP_DB should be in sync

@arlakshm arlakshm added the nat label Aug 26, 2020
@AkhileshSamineni
Copy link
Contributor

@jciesiex NAT Bindings will be at CONFIG_DB only.
Based on NAT_BINDINGS table, NAT manager will add iptables NAT rules which are used for dynamic NAT translations and NAT_BINDINGS table is not pushed to APPL_DB. This is expected behavior only.

@arlakshm
Copy link
Contributor

Expected behaviour

EdenGri pushed a commit to EdenGri/sonic-swss that referenced this issue Feb 28, 2022
This commit fix the exception thrown by struct.pack when attempting to pack a unicode string.
The script ```fast-reboot-dump.py``` will throw an exception in python3 because ```struct.pack``` requires ```bytes``` for ```s```.
```
Traceback: Traceback (most recent call last):
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 299, in <module>
sonic-net#12    res = main()
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 292, in main
sonic-net#12    send_garp_nd(neighbor_entries, map_mac_ip_per_vlan)
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 221, in send_garp_nd
sonic-net#12    src_ip_addrs = {vlan_name:get_iface_ip_addr(vlan_name) for vlan_name,_,_ in neighbor_entries}
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 221, in <dictcomp>
sonic-net#12    src_ip_addrs = {vlan_name:get_iface_ip_addr(vlan_name) for vlan_name,_,_ in neighbor_entries}
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 195, in get_iface_ip_addr
sonic-net#12    return get_if(iff, SIOCGIFADDR)[20:24]
sonic-net#12  File "/usr/local/bin/fast-reboot-dump.py", line 185, in get_if
sonic-net#12    ifreq = ioctl(s, cmd, struct.pack("16s16x",iff))
sonic-net#12  struct.error: argument for 's' must be a bytes object
```

Signed-off-by: bingwang <bingwang@microsoft.com>
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

3 participants